Spaces:
Sleeping
Sleeping
text generation
Browse files
app.py
CHANGED
|
@@ -2,15 +2,12 @@ from transformers import pipeline
|
|
| 2 |
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
-
|
| 6 |
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
def test_fun(input):
|
| 13 |
-
return input
|
| 14 |
|
| 15 |
|
| 16 |
demo = gr.Blocks()
|
|
@@ -21,7 +18,7 @@ with demo:
|
|
| 21 |
b1 = gr.Button('Submit')
|
| 22 |
output_text = gr.Textbox()
|
| 23 |
|
| 24 |
-
b1.click(fn =
|
| 25 |
|
| 26 |
if __name__=='__main__':
|
| 27 |
demo.launch()
|
|
|
|
| 2 |
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
+
pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 6 |
|
| 7 |
|
| 8 |
+
def pred(input):
|
| 9 |
+
output = pipe_flan(input)
|
| 10 |
+
return output[0]["generated_text"]
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
demo = gr.Blocks()
|
|
|
|
| 18 |
b1 = gr.Button('Submit')
|
| 19 |
output_text = gr.Textbox()
|
| 20 |
|
| 21 |
+
b1.click(fn = pred, inputs=input_text, outputs= output_text)
|
| 22 |
|
| 23 |
if __name__=='__main__':
|
| 24 |
demo.launch()
|