Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,20 +35,7 @@ def generate_recipe(ingredients):
|
|
| 35 |
return error_text
|
| 36 |
|
| 37 |
|
| 38 |
-
|
| 39 |
-
# Show "loading" message before starting recipe generation
|
| 40 |
-
generated_recipe.value = "Generating recipe... Please wait..."
|
| 41 |
-
|
| 42 |
-
# Generate recipe in the background
|
| 43 |
-
generated_text = generate_recipe(user_input)
|
| 44 |
-
|
| 45 |
-
# Update the recipe output once generated
|
| 46 |
-
generated_recipe.value = generated_text
|
| 47 |
-
|
| 48 |
-
return generated_recipe
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
with gr.Blocks(css="""
|
| 52 |
#chat-container {
|
| 53 |
display: flex;
|
| 54 |
flex-direction: column;
|
|
@@ -94,9 +81,10 @@ with gr.Blocks(css="""
|
|
| 94 |
inputs=[user_ingredients]
|
| 95 |
)
|
| 96 |
|
|
|
|
| 97 |
generate_button.click(
|
| 98 |
-
fn=
|
| 99 |
-
inputs=[user_ingredients
|
| 100 |
outputs=[generated_recipe]
|
| 101 |
)
|
| 102 |
|
|
|
|
| 35 |
return error_text
|
| 36 |
|
| 37 |
|
| 38 |
+
with gr.Blocks(css="""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
#chat-container {
|
| 40 |
display: flex;
|
| 41 |
flex-direction: column;
|
|
|
|
| 81 |
inputs=[user_ingredients]
|
| 82 |
)
|
| 83 |
|
| 84 |
+
# Now we directly generate the recipe when the button is clicked
|
| 85 |
generate_button.click(
|
| 86 |
+
fn=generate_recipe,
|
| 87 |
+
inputs=[user_ingredients],
|
| 88 |
outputs=[generated_recipe]
|
| 89 |
)
|
| 90 |
|