tigeryfan commited on
Commit
7699942
·
verified ·
1 Parent(s): 6ed5432

Create backend.py (#1)

Browse files

- Create backend.py (dc2688644b4cfed14328406cccf850ade6fdcd26)

Files changed (1) hide show
  1. backend.py +10 -0
backend.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+
3
+ pipe = pipeline(model="openai/gpt-oss-20b")
4
+ 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"""
5
+
6
+ def generate_text(text):
7
+ result = pipe(prompt + text)
8
+ if result and isinstance(result, list):
9
+ return result[0].get("generated_text", "")
10
+ return ""