Spaces:
Runtime error
Runtime error
Update ui/gradio_ui.py
Browse files- ui/gradio_ui.py +10 -3
ui/gradio_ui.py
CHANGED
|
@@ -1,6 +1,12 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
def ui(controller):#get_first_result,get_second_result): #controller):
|
| 5 |
with gr.Blocks() as ui:
|
| 6 |
with gr.Row():
|
|
@@ -36,9 +42,10 @@ def ui(controller):#get_first_result,get_second_result): #controller):
|
|
| 36 |
inputs=[sketch, first_prompt, second_prompt],
|
| 37 |
label='Examples. Be concrete as much as possible.')
|
| 38 |
|
| 39 |
-
|
|
|
|
| 40 |
improve_sketch.click(fn=controller.get_first_result,
|
| 41 |
-
inputs=[
|
| 42 |
outputs=improved_sketch_view)
|
| 43 |
|
| 44 |
result_button.click(fn=controller.get_second_result,
|
|
@@ -46,7 +53,7 @@ def ui(controller):#get_first_result,get_second_result): #controller):
|
|
| 46 |
outputs=result)
|
| 47 |
|
| 48 |
firts_prompt_helper.click(fn=controller.get_help_w_prompt,
|
| 49 |
-
inputs=[
|
| 50 |
outputs=first_prompt)
|
| 51 |
|
| 52 |
second_prompt_helper.click(fn=controller.get_help_w_prompt,
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
| 3 |
|
| 4 |
+
|
| 5 |
+
SER_SKETCH=None
|
| 6 |
+
|
| 7 |
+
def get_img_from_sketchpad(img):
|
| 8 |
+
return Image.fromarray(img["composite"])
|
| 9 |
+
|
| 10 |
def ui(controller):#get_first_result,get_second_result): #controller):
|
| 11 |
with gr.Blocks() as ui:
|
| 12 |
with gr.Row():
|
|
|
|
| 42 |
inputs=[sketch, first_prompt, second_prompt],
|
| 43 |
label='Examples. Be concrete as much as possible.')
|
| 44 |
|
| 45 |
+
sketch.input(get_img_from_sketchpad, outputs=SER_SKETCH, inputs=sketch, show_progress="hidden")
|
| 46 |
+
|
| 47 |
improve_sketch.click(fn=controller.get_first_result,
|
| 48 |
+
inputs=[SER_SKETCH), first_prompt, first_negative_prompt], #[sketch, first_prompt, first_negative_prompt],
|
| 49 |
outputs=improved_sketch_view)
|
| 50 |
|
| 51 |
result_button.click(fn=controller.get_second_result,
|
|
|
|
| 53 |
outputs=result)
|
| 54 |
|
| 55 |
firts_prompt_helper.click(fn=controller.get_help_w_prompt,
|
| 56 |
+
inputs=[SER_SKETCH], #[sketch],
|
| 57 |
outputs=first_prompt)
|
| 58 |
|
| 59 |
second_prompt_helper.click(fn=controller.get_help_w_prompt,
|