Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,7 +49,13 @@ def generate_recipe(description):
|
|
49 |
def process_image(image):
|
50 |
description = image_to_text(image)[0]['generated_text']
|
51 |
recipe = generate_recipe(description)
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
# Paso 4: Crear la interfaz de Gradio
|
55 |
iface = gr.Interface(
|
@@ -57,11 +63,12 @@ iface = gr.Interface(
|
|
57 |
inputs=gr.Image(type="pil"),
|
58 |
outputs=[
|
59 |
gr.Textbox(label="Description"),
|
60 |
-
gr.
|
|
|
61 |
],
|
62 |
title="Recipe Generator from Dish Image",
|
63 |
description="Upload an image of a dish to get a description, ingredient list, and step-by-step recipe."
|
64 |
)
|
65 |
|
66 |
# Lanzar la aplicaci贸n de Gradio
|
67 |
-
iface.launch()
|
|
|
49 |
def process_image(image):
|
50 |
description = image_to_text(image)[0]['generated_text']
|
51 |
recipe = generate_recipe(description)
|
52 |
+
|
53 |
+
# Guardar la receta en un archivo temporal
|
54 |
+
recipe_file_path = "/tmp/recipe.txt"
|
55 |
+
with open(recipe_file_path, "w") as file:
|
56 |
+
file.write(recipe)
|
57 |
+
|
58 |
+
return description, recipe, recipe_file_path
|
59 |
|
60 |
# Paso 4: Crear la interfaz de Gradio
|
61 |
iface = gr.Interface(
|
|
|
63 |
inputs=gr.Image(type="pil"),
|
64 |
outputs=[
|
65 |
gr.Textbox(label="Description"),
|
66 |
+
gr.Text(label="Recipe"),
|
67 |
+
gr.File(label="Download Recipe") # Bot贸n para descargar el archivo
|
68 |
],
|
69 |
title="Recipe Generator from Dish Image",
|
70 |
description="Upload an image of a dish to get a description, ingredient list, and step-by-step recipe."
|
71 |
)
|
72 |
|
73 |
# Lanzar la aplicaci贸n de Gradio
|
74 |
+
iface.launch()
|