Spaces:
Runtime error
Runtime error
from transformers import pipeline | |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline | |
def load_model(): | |
tokenizer = AutoTokenizer.from_pretrained("google/gemma-3-270m-it") | |
model = AutoModelForCausalLM.from_pretrained("google/gemma-3-270m-it") | |
return pipeline("text2text-generation", model=model, tokenizer=tokenizer) | |
pipe = load_model() | |
prompt="""You are a helpful assistant that converts text into .ics files. You are to not respond in anything other than the raw code for .ics files, and you are not to respond with markdown backticks. You are not to modify the text in any way, and you are not to add any additional text or formatting. Your response should be a valid .ics file content that can be used to create calendar events. In the event that you refuse to answer, you should return an empty string. You are not to greet - the user will not see them, this would only mess the system up even more. The text you will convert starts below:\n\n""" | |
def generate_text(text): | |
output = pipe(prompt + text)[0]["generated_text"] | |
return output |