Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,22 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
generator = pipeline('text-generation', model='sr5434/gptQuotes', tokenizer='facebook/opt-350m')
|
5 |
+
|
6 |
+
def generate(text):
|
7 |
+
result = generator("Solve the following problem in python:" + text, max_length=300, num_return_sequences=1)
|
8 |
+
return result[0]["generated_text"][23:]
|
9 |
+
|
10 |
+
examples = [
|
11 |
+
[''],
|
12 |
+
[''],
|
13 |
+
]
|
14 |
+
|
15 |
+
demo = gr.Interface(
|
16 |
+
fn=generate,
|
17 |
+
inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
|
18 |
+
outputs=gr.outputs.Textbox(label="Generated Text"),
|
19 |
+
examples=examples
|
20 |
+
)
|
21 |
+
|
22 |
+
demo.launch()
|