atharvapawar commited on
Commit
85b6abd
·
verified ·
1 Parent(s): 0d0ee88

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import AutoPipelineForText2Image
3
+ import torch
4
+
5
+ pipeline = AutoPipelineForText2Image.from_pretrained("sd-dreambooth-library/herge-style", torch_dtype=torch.float16).to("cuda")
6
+
7
+ def generate_image(prompt):
8
+ pipeline.enable_freeu(s1=0.6, s2=0.4, b1=1.1, b2=1.2)
9
+ image = pipeline(prompt).images[0]
10
+ return image.permute(1, 2, 0).cpu().numpy()
11
+
12
+ title = "DreamBooth Gradio App"
13
+ description = "Generate images based on prompts using the DreamBooth model."
14
+
15
+ prompt_textbox = gr.Textbox(lines=3, label="Prompt")
16
+ image_output = gr.Image(draw_fn=generate_image, label="Generated Image")
17
+
18
+ gr.Interface(fn=generate_image, inputs=prompt_textbox, outputs=image_output, title=title, description=description).launch()