Adi-69s commited on
Commit
459637f
1 Parent(s): 5f69781

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Assuming `pipe` is correctly defined elsewhere for image generation
12
+ params = {
13
+ 'prompt': prompt,
14
+ 'num_inference_steps': 100,
15
+ 'num_images_per_prompt': 2, # Assuming this is a valid parameter
16
+ 'height': int(1.2 * 640) # Assuming height is calculated based on weight
17
+ }
18
+
19
+ # Assuming `pipe` is correctly defined elsewhere
20
+ img = pipe(**params).images
21
+ return img[0], img[1]
22
+
23
+ import gradio as gr
24
+
25
+ demo = gr.Interface(
26
+ fn=generate_image_interface,
27
+ inputs=["text"],
28
+ outputs=["image", "image"],
29
+ title="Image Generation Interface",
30
+ description="Generate images based on prompts."
31
+ )
32
+
33
+ demo.launch()