Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
model_checkpoint = "erwanlc/t5-cocktails_recipe-base"
|
5 |
+
tt_generator = pipeline("text2text-generation", model=model_checkpoint)
|
6 |
+
|
7 |
+
def generate_text(inp):
|
8 |
+
result = tt_generator(inp, min_length=20, max_length=1024, do_sample=True, temperature=1.0, top_p=1.0)
|
9 |
+
return result
|
10 |
+
|
11 |
+
output_text = gr.outputs.Textbox()
|
12 |
+
gr.Interface(fn=generate_text, inputs="textbox", outputs=output_text).launch(share=True)
|