Spaces:
Running
Running
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load model
|
5 |
+
generator = pipeline("text2text-generation", model="flax-community/t5-recipe-generation")
|
6 |
+
|
7 |
+
# Function to generate recipes
|
8 |
+
def generate_recipe(ingredients):
|
9 |
+
result = generator(ingredients)
|
10 |
+
return result[0]["generated_text"]
|
11 |
+
|
12 |
+
# Gradio UI
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=generate_recipe,
|
15 |
+
inputs=gr.Textbox(placeholder="Enter ingredients..."),
|
16 |
+
outputs="text",
|
17 |
+
title="Chef Claude - AI Recipe Generator",
|
18 |
+
description="Enter ingredients, and Chef Claude will generate a recipe for you!"
|
19 |
+
)
|
20 |
+
|
21 |
+
iface.launch()
|