Spaces:
Running
Running
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from diffusers import DiffusionPipeline
|
3 |
+
|
4 |
+
# Load the pre-trained model pipeline
|
5 |
+
pipe = DiffusionPipeline.from_pretrained("ImageInception/ArtifyAI")
|
6 |
+
|
7 |
+
# Define a function to generate the image based on user input text
|
8 |
+
def generate_image(prompt):
|
9 |
+
# Generate the image from the prompt
|
10 |
+
image = pipe(prompt).images[0]
|
11 |
+
return image
|
12 |
+
|
13 |
+
# Define the Gradio interface
|
14 |
+
iface = gr.Interface(
|
15 |
+
fn=generate_image,
|
16 |
+
inputs="text",
|
17 |
+
outputs="image",
|
18 |
+
title="ArtifyAI Generator",
|
19 |
+
description="Enter a prompt and generate an image using the ArtifyAI model."
|
20 |
+
)
|
21 |
+
|
22 |
+
# Launch the Gradio app
|
23 |
+
if __name__ == "__main__":
|
24 |
+
iface.launch()
|