Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
return recipe, calories, sugars
|
| 14 |
-
|
| 15 |
-
# Create the Gradio interface
|
| 16 |
-
iface = gr.Interface(
|
| 17 |
-
fn=generate_recipe,
|
| 18 |
-
inputs=gr.inputs.Textbox(lines=2, placeholder="Enter ingredients here..."),
|
| 19 |
-
outputs=["text", "text", "text"],
|
| 20 |
-
title="Recipe Generator",
|
| 21 |
-
description="Enter ingredients to get a recipe suggestion along with calories and sugars."
|
| 22 |
)
|
| 23 |
|
|
|
|
|
|
|
|
|
|
| 24 |
# Launch the interface
|
| 25 |
-
iface.launch()
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
import gradio as gr
|
| 4 |
+
|
| 5 |
from transformers import pipeline
|
| 6 |
|
| 7 |
+
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
| 8 |
+
|
| 9 |
+
def predict(text):
|
| 10 |
+
return pipe(text)[0]["translation_text"]
|
| 11 |
+
|
| 12 |
+
demo = gr.Interface(
|
| 13 |
+
fn=predict,
|
| 14 |
+
inputs='text',
|
| 15 |
+
outputs='text',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
)
|
| 17 |
|
| 18 |
+
demo.launch()
|
| 19 |
+
|
| 20 |
+
|
| 21 |
# Launch the interface
|
| 22 |
+
#iface.launch()
|