File size: 872 Bytes
32f5fd9
2cf6be0
 
 
 
6b0d828
 
 
2cf6be0
 
 
32f5fd9
2cf6be0
 
fa0ee64
2cf6be0
 
fa0ee64
 
 
 
 
 
 
f0f8ecd
fa0ee64
2cf6be0
fa0ee64
2cf6be0
fa0ee64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
+import spaces
import gradio as gr
import torch
from diffusers import DiffusionPipeline

model_id = "Apocalypse-19/shoe-generator"
pipe = DiffusionPipeline.from_pretrained(model_id)

pipe.to("cuda")

# Function to generate an image from text using diffusion
[email protected]
def generate_image(prompt):
    
    images = pipe(prompt=prompt, negative_prompt=neg_prompt,)
    return images[0]

_TITLE = "Shoe Generator"
with gr.Blocks(_TITLE) as ShoeGen:
    with gr.Row():
        with gr.Column():
            prompt = gr.Textbox(lines=3, label="Enter a prompt")
            neg_prompt = gr.Textbox(lines=3, label="Enter a negative prompt")
        with gr.Column():
            button_gen = gr.Button("Generate Image")
            output = gr.Image(label="Generated Image")

    button_gen.click(generate_image, inputs=[prompt, neg_prompt], outputs=output)

ShoeGen.launch()