Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -317,7 +317,11 @@ with gr.Blocks(theme='gradio/soft') as demo:
|
|
317 |
with gr.Column():
|
318 |
prompt_input = gr.Textbox(label="Prompt")
|
319 |
negative_prompt = gr.Textbox(label="Negative Prompt")
|
320 |
-
|
|
|
|
|
|
|
|
|
321 |
# output_image = gr.Gallery(label='Output Image', show_label=False, elem_id="gallery").style(grid=3, height='auto')
|
322 |
submit_btn = gr.Button(value = "Submit")
|
323 |
# inputs = [prompt_input, negative_prompt, input_image]
|
@@ -354,12 +358,17 @@ with gr.Blocks(theme='gradio/soft') as demo:
|
|
354 |
"example4.png"
|
355 |
],
|
356 |
],
|
357 |
-
inputs=[prompt_input, negative_prompt,
|
358 |
outputs=[output_image, system_info],
|
359 |
fn=infer,
|
360 |
cache_examples=True,
|
361 |
)
|
362 |
-
|
|
|
|
|
|
|
|
|
|
|
363 |
inputs = [prompt_input, negative_prompt, input_image, model_type]
|
364 |
submit_btn.click(fn=infer, inputs=inputs, outputs=[output_image, system_info])
|
365 |
|
|
|
317 |
with gr.Column():
|
318 |
prompt_input = gr.Textbox(label="Prompt")
|
319 |
negative_prompt = gr.Textbox(label="Negative Prompt")
|
320 |
+
with gr.Box():
|
321 |
+
with gr.Tab("Upload Image"):
|
322 |
+
upload_image = gr.Image(label="Upload Image", source="upload")
|
323 |
+
with gr.Tab("Webcam"):
|
324 |
+
webcam_image = gr.Image(label="Webcam", source="webcam")
|
325 |
# output_image = gr.Gallery(label='Output Image', show_label=False, elem_id="gallery").style(grid=3, height='auto')
|
326 |
submit_btn = gr.Button(value = "Submit")
|
327 |
# inputs = [prompt_input, negative_prompt, input_image]
|
|
|
358 |
"example4.png"
|
359 |
],
|
360 |
],
|
361 |
+
inputs=[prompt_input, negative_prompt, upload_image, model_type],
|
362 |
outputs=[output_image, system_info],
|
363 |
fn=infer,
|
364 |
cache_examples=True,
|
365 |
)
|
366 |
+
# check source of image
|
367 |
+
if upload_image and webcam_image is None:
|
368 |
+
input_image = upload_image
|
369 |
+
else:
|
370 |
+
input_image = webcam_image
|
371 |
+
|
372 |
inputs = [prompt_input, negative_prompt, input_image, model_type]
|
373 |
submit_btn.click(fn=infer, inputs=inputs, outputs=[output_image, system_info])
|
374 |
|