ManchanTime commited on
Commit
f0f2255
1 Parent(s): 3c885a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -1,11 +1,9 @@
1
  import gradio as gr
2
  from diffusers import StableDiffusionPipeline
3
- import torch
4
 
5
  # Load pre-trained model
6
  model_id = "CompVis/stable-diffusion-v1-4"
7
- pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
8
- pipe = pipe.to("cpu") # 'cuda' 대신 'cpu'로 변경
9
 
10
  def generate_image(prompt):
11
  # Generate image from text prompt
@@ -15,8 +13,8 @@ def generate_image(prompt):
15
  # Define Gradio UI
16
  iface = gr.Interface(
17
  fn=generate_image,
18
- inputs=gr.inputs.Textbox(lines=2, placeholder="Enter a text prompt here..."),
19
- outputs="image",
20
  title="DreamBooth Image Generation",
21
  description="Enter a text prompt to generate an image using DreamBooth.",
22
  examples=[
 
1
  import gradio as gr
2
  from diffusers import StableDiffusionPipeline
 
3
 
4
  # Load pre-trained model
5
  model_id = "CompVis/stable-diffusion-v1-4"
6
+ pipe = StableDiffusionPipeline.from_pretrained(model_id)
 
7
 
8
  def generate_image(prompt):
9
  # Generate image from text prompt
 
13
  # Define Gradio UI
14
  iface = gr.Interface(
15
  fn=generate_image,
16
+ inputs=gr.components.Textbox(lines=2, placeholder="Enter a text prompt here..."),
17
+ outputs=gr.components.Image(),
18
  title="DreamBooth Image Generation",
19
  description="Enter a text prompt to generate an image using DreamBooth.",
20
  examples=[