Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
import re
|
2 |
import gradio as gr
|
3 |
from transformers import pipeline
|
|
|
4 |
|
5 |
model_checkpoint = "erwanlc/t5-cocktails_recipe-base"
|
6 |
tt_generator = pipeline("text2text-generation", model=model_checkpoint)
|
@@ -22,5 +22,21 @@ def generate_text(ingredients):
|
|
22 |
result = "\n".join(result)
|
23 |
return result
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
output_text = gr.outputs.Textbox()
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
+
import re
|
4 |
|
5 |
model_checkpoint = "erwanlc/t5-cocktails_recipe-base"
|
6 |
tt_generator = pipeline("text2text-generation", model=model_checkpoint)
|
|
|
22 |
result = "\n".join(result)
|
23 |
return result
|
24 |
|
25 |
+
title = "Create original cocktails based on your ingredients"
|
26 |
+
description = "Finetuned T5 on cocktails recipe. Write your ingredients separated by a comma to generate a cocktail. This work was inspired by Chef Transformer (https://huggingface.co/spaces/flax-community/chef-transformer)."
|
27 |
+
examples = [
|
28 |
+
["rum,apricot liqueur,lime juice,sugar syrup"],
|
29 |
+
["gin,honey,basil,soda water"]
|
30 |
+
]
|
31 |
+
|
32 |
output_text = gr.outputs.Textbox()
|
33 |
+
|
34 |
+
gr.Interface(
|
35 |
+
fn=generate_text,
|
36 |
+
inputs="textbox",
|
37 |
+
outputs=output_text,
|
38 |
+
title=title,
|
39 |
+
description=description,
|
40 |
+
examples=examples,
|
41 |
+
theme="huggingface",
|
42 |
+
).launch(share=True)
|