Spaces:
Build error
Build error
Jay Patel commited on
Commit ·
8af8320
1
Parent(s): bc5d10a
use accordian
Browse files- home_view/ui_home.py +17 -16
home_view/ui_home.py
CHANGED
|
@@ -49,7 +49,7 @@ def SetSelected(playersCB):
|
|
| 49 |
break
|
| 50 |
|
| 51 |
def PlayGame():
|
| 52 |
-
return gr.update(visible=True)
|
| 53 |
|
| 54 |
def Predict(sketch):
|
| 55 |
confidences = sk.Predict(sketch)
|
|
@@ -104,25 +104,26 @@ with gr.Blocks() as ui:
|
|
| 104 |
desc=gr.TextArea(info=constants.GAME_DESC, interactive=False, show_label=False,
|
| 105 |
placeholder=constants.GAME_DESC_PLACEHOLDER, lines=3)
|
| 106 |
playBtn = gr.Button(value=constants.PLAY_GAME, variant="primary")
|
| 107 |
-
with gr.Row(visible=False) as holder:
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
|
|
|
| 121 |
|
| 122 |
sketch.change(Predict, inputs=[sketch], outputs=[label])
|
| 123 |
playersCB.change(SetSelected, inputs=[playersCB], outputs=[])
|
| 124 |
createBtn.click(CreateGame, inputs=[], outputs=[df4,desc,gameTitle])
|
| 125 |
-
playBtn.click(PlayGame, inputs=[], outputs=[holder
|
| 126 |
|
| 127 |
with gr.Blocks() as dfs:
|
| 128 |
fetchBtn=gr.Button(value=constants.FETCH_DATA, variant="primary")
|
|
|
|
| 49 |
break
|
| 50 |
|
| 51 |
def PlayGame():
|
| 52 |
+
return gr.update(visible=True)
|
| 53 |
|
| 54 |
def Predict(sketch):
|
| 55 |
confidences = sk.Predict(sketch)
|
|
|
|
| 104 |
desc=gr.TextArea(info=constants.GAME_DESC, interactive=False, show_label=False,
|
| 105 |
placeholder=constants.GAME_DESC_PLACEHOLDER, lines=3)
|
| 106 |
playBtn = gr.Button(value=constants.PLAY_GAME, variant="primary")
|
| 107 |
+
with gr.Row(visible=False) as holder:
|
| 108 |
+
with gr.Accordion("Drawing"):
|
| 109 |
+
sketch=gr.Image(image_mode="L", source="canvas", width=600, height =600, invert_colors=True, interactive=True,
|
| 110 |
+
brush_radius=.5, type="numpy", label="Sketch", show_label=True, show_download_button=False)
|
| 111 |
+
label=gr.Label()
|
| 112 |
+
with gr.Accordion("Chat", open=False):
|
| 113 |
+
chat = gr.ChatInterface(
|
| 114 |
+
chatBot,
|
| 115 |
+
theme="soft",
|
| 116 |
+
examples=["Hello", "Am I cool?", "Are tomatoes vegetables?"],
|
| 117 |
+
cache_examples=True,
|
| 118 |
+
retry_btn=None,
|
| 119 |
+
undo_btn="Delete Previous",
|
| 120 |
+
clear_btn="Clear",
|
| 121 |
+
)
|
| 122 |
|
| 123 |
sketch.change(Predict, inputs=[sketch], outputs=[label])
|
| 124 |
playersCB.change(SetSelected, inputs=[playersCB], outputs=[])
|
| 125 |
createBtn.click(CreateGame, inputs=[], outputs=[df4,desc,gameTitle])
|
| 126 |
+
playBtn.click(PlayGame, inputs=[], outputs=[holder])
|
| 127 |
|
| 128 |
with gr.Blocks() as dfs:
|
| 129 |
fetchBtn=gr.Button(value=constants.FETCH_DATA, variant="primary")
|