Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from diffusers import DiffusionPipeline
|
2 |
+
|
3 |
+
pipe = DiffusionPipeline.from_pretrained("prompthero/openjourney")
|
4 |
+
|
5 |
+
# prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
|
6 |
+
# image = pipe(prompt).images[0]
|
7 |
+
|
8 |
+
def generate(input_prompt):
|
9 |
+
generations = pipe(input_prompt)
|
10 |
+
generated_img = generations.images[0]
|
11 |
+
return generated_img
|
12 |
+
|
13 |
+
gradio_app = gr.Interface(
|
14 |
+
generate,
|
15 |
+
inputs=gr.Text(label="What kind of image would you like to generate?")
|
16 |
+
outputs=[gr.Image(label="Generated Image")],
|
17 |
+
title="IMAGE GENERATION!!",
|
18 |
+
)
|
19 |
+
|
20 |
+
if __name__ == "__main__":
|
21 |
+
gradio_app.launch()
|