Adi-69s commited on
Commit
0ee8c24
·
verified ·
1 Parent(s): cb39462

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +31 -0
  2. requirements.txt +0 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import StableDiffusionPipeline
2
+ import matplotlib.pyplot as plt
3
+ import torch
4
+
5
+ model_id1 = "dreamlike-art/dreamlike-diffusion-1.0"
6
+
7
+ pipe = StableDiffusionPipeline.from_pretrained(model_id1, use_safetensors=True)
8
+ pipe = pipe.to("cpu")
9
+
10
+ def generate_image_interface(prompt):
11
+ params = {
12
+ 'prompt': prompt,
13
+ 'num_inference_steps': 100,
14
+ 'num_images_per_prompt': 2,
15
+ 'height': int(1.2 * 640)
16
+ }
17
+
18
+ img = pipe(**params).images
19
+ return img[0], img[1]
20
+
21
+ import gradio as gr
22
+
23
+ demo = gr.Interface(
24
+ fn=generate_image_interface,
25
+ inputs=["text"],
26
+ outputs=["image", "image"],
27
+ title="Image Generation Interface",
28
+ description="Generate images based on prompts."
29
+ )
30
+
31
+ demo.launch()
requirements.txt ADDED
Binary file (2.79 kB). View file