Spaces:
Runtime error
Runtime error
Jordan Legg
commited on
Commit
β’
d53ee34
1
Parent(s):
a7d057d
whoops forgot the gradio code
Browse files
app.py
CHANGED
@@ -104,4 +104,30 @@ def infer(prompt, init_image=None, seed=42, randomize_seed=False, width=1024, he
|
|
104 |
return Image.new("RGB", (width, height), (255, 0, 0)), seed # Red fallback image
|
105 |
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
demo.launch()
|
|
|
104 |
return Image.new("RGB", (width, height), (255, 0, 0)), seed # Red fallback image
|
105 |
|
106 |
|
107 |
+
# Gradio interface setup
|
108 |
+
with gr.Blocks() as demo:
|
109 |
+
with gr.Row():
|
110 |
+
prompt = gr.Textbox(label="Prompt")
|
111 |
+
init_image = gr.Image(label="Initial Image (optional)", type="pil")
|
112 |
+
|
113 |
+
with gr.Row():
|
114 |
+
generate = gr.Button("Generate")
|
115 |
+
|
116 |
+
with gr.Row():
|
117 |
+
result = gr.Image(label="Result")
|
118 |
+
seed_output = gr.Number(label="Seed")
|
119 |
+
|
120 |
+
with gr.Accordion("Advanced Settings", open=False):
|
121 |
+
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=42)
|
122 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
123 |
+
width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=1024)
|
124 |
+
height = gr.Slider(label="Height", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=1024)
|
125 |
+
num_inference_steps = gr.Slider(label="Number of inference steps", minimum=1, maximum=50, step=1, value=4)
|
126 |
+
|
127 |
+
generate.click(
|
128 |
+
infer,
|
129 |
+
inputs=[prompt, init_image, seed, randomize_seed, width, height, num_inference_steps],
|
130 |
+
outputs=[result, seed_output]
|
131 |
+
)
|
132 |
+
|
133 |
demo.launch()
|