MaxMilan1 commited on
Commit
262e1d3
·
1 Parent(s): 591bf9d
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -3,28 +3,27 @@ import gradio as gr
3
  import torch
4
  from diffusers import DiffusionPipeline
5
 
6
- model_id = "Apocalypse-19/shoe-generator"
7
  pipe = DiffusionPipeline.from_pretrained(model_id)
8
 
9
  pipe.to("cuda")
10
 
11
  # Function to generate an image from text using diffusion
12
  @spaces.GPU
13
- def generate_image(prompt, neg_prompt):
14
 
15
- images = pipe(prompt, negative_prompt=neg_prompt,)
16
  return images[0]
17
 
18
  _TITLE = "Shoe Generator"
19
  with gr.Blocks(_TITLE) as ShoeGen:
20
  with gr.Row():
21
  with gr.Column():
22
- prompt = gr.Textbox(lines=3, label="Enter a prompt")
23
- neg_prompt = gr.Textbox(lines=3, label="Enter a negative prompt")
24
- with gr.Column():
25
  button_gen = gr.Button("Generate Image")
 
26
  output = gr.Image(label="Generated Image")
27
 
28
- button_gen.click(generate_image, inputs=[prompt, neg_prompt], outputs=output)
29
 
30
  ShoeGen.launch()
 
3
  import torch
4
  from diffusers import DiffusionPipeline
5
 
6
+ model_id = "CiroN2022/shoes"
7
  pipe = DiffusionPipeline.from_pretrained(model_id)
8
 
9
  pipe.to("cuda")
10
 
11
  # Function to generate an image from text using diffusion
12
  @spaces.GPU
13
+ def generate_image(prompt):
14
 
15
+ images = pipe(prompt)
16
  return images[0]
17
 
18
  _TITLE = "Shoe Generator"
19
  with gr.Blocks(_TITLE) as ShoeGen:
20
  with gr.Row():
21
  with gr.Column():
22
+ prompt = gr.Textbox(label="Enter a prompt")
 
 
23
  button_gen = gr.Button("Generate Image")
24
+ with gr.Column():
25
  output = gr.Image(label="Generated Image")
26
 
27
+ button_gen.click(generate_image, inputs=[prompt], outputs=output)
28
 
29
  ShoeGen.launch()