Spaces:
Runtime error

Sha77755 commited on
Commit
eba4de1
·
verified ·
1 Parent(s): 29d5919

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Text-to-image pipeline initialize karna
5
+ pipe = pipeline("text-to-image-generation", model="dalle-mini/dalle-mini")
6
+
7
+ def generate_image(text):
8
+ # Text se image generate karna
9
+ result = pipe(text)
10
+ return result[0]["generated_image"]
11
+
12
+ # Gradio Interface banana
13
+ iface = gr.Interface(
14
+ fn=generate_image,
15
+ inputs="text",
16
+ outputs="image",
17
+ title="Text-to-Image Generator",
18
+ description="Enter a description, and this AI will generate an image based on it."
19
+ )
20
+
21
+ # Launch the app
22
+ iface.launch()