daniescamilla commited on
Commit
d96315a
verified
1 Parent(s): 3967043

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
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
- return description, recipe
 
 
 
 
 
 
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.Textbox(label="Recipe", lines=10, markdown=False) # Desactiva el formato Markdown
 
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()