Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -64,7 +64,7 @@ STYLE = """
|
|
64 |
margin-right: 70px;
|
65 |
}
|
66 |
|
67 |
-
#
|
68 |
z-index: 100;
|
69 |
position: absolute;
|
70 |
width: 50%;
|
@@ -137,7 +137,11 @@ function() {
|
|
137 |
history.push([element.ping, element.pong])
|
138 |
);
|
139 |
}
|
140 |
-
|
|
|
|
|
|
|
|
|
141 |
return [history, local_data];
|
142 |
}
|
143 |
"""
|
@@ -150,7 +154,7 @@ def add_pingpong(idx, ld, ping):
|
|
150 |
|
151 |
ppm = res[idx]
|
152 |
ppm.add_pingpong(PingPong(ping, "dang!!!!!!!"))
|
153 |
-
return ppm.build_uis(), str(res)
|
154 |
|
155 |
def set_chatbot(btn, ld):
|
156 |
choice = 0
|
@@ -192,7 +196,7 @@ with gr.Blocks(css=STYLE, elem_id='container-col') as block:
|
|
192 |
fifth = gr.Button("5th", elem_classes=["custom-btn"])
|
193 |
|
194 |
with gr.Column(scale=8, elem_id="right-pane"):
|
195 |
-
with gr.Column(elem_id="
|
196 |
with gr.Row(scale=1):
|
197 |
with gr.Column(elem_id="initial-popup-left-pane"):
|
198 |
gr.Markdown("GradioChat", elem_id="initial-popup-title")
|
@@ -206,7 +210,7 @@ with gr.Blocks(css=STYLE, elem_id='container-col') as block:
|
|
206 |
with gr.Row():
|
207 |
ex_btn1 = gr.Button("hello world", elem_classes=["example-btn"])
|
208 |
ex_btn2 = gr.Button("what's up?", elem_classes=["example-btn"])
|
209 |
-
ex_btn3 = gr.Button("this is
|
210 |
|
211 |
chatbot = gr.Chatbot(elem_id='chatbot')
|
212 |
instruction_txtbox = gr.Textbox(
|
@@ -233,7 +237,7 @@ with gr.Blocks(css=STYLE, elem_id='container-col') as block:
|
|
233 |
instruction_txtbox.submit(
|
234 |
add_pingpong,
|
235 |
[idx, local_data, instruction_txtbox],
|
236 |
-
[chatbot, local_data]
|
237 |
).then(
|
238 |
None, local_data, None,
|
239 |
_js="(v)=>{ setStorage('local_data',v) }"
|
|
|
64 |
margin-right: 70px;
|
65 |
}
|
66 |
|
67 |
+
#initial-popup {
|
68 |
z-index: 100;
|
69 |
position: absolute;
|
70 |
width: 50%;
|
|
|
137 |
history.push([element.ping, element.pong])
|
138 |
);
|
139 |
}
|
140 |
+
|
141 |
+
if(history.length == 0) {
|
142 |
+
document.querySelectorAll("#initial-popup")[0].style.display = "block"
|
143 |
+
}
|
144 |
+
|
145 |
return [history, local_data];
|
146 |
}
|
147 |
"""
|
|
|
154 |
|
155 |
ppm = res[idx]
|
156 |
ppm.add_pingpong(PingPong(ping, "dang!!!!!!!"))
|
157 |
+
return ppm.build_uis(), str(res), gr.update(visible=False)
|
158 |
|
159 |
def set_chatbot(btn, ld):
|
160 |
choice = 0
|
|
|
196 |
fifth = gr.Button("5th", elem_classes=["custom-btn"])
|
197 |
|
198 |
with gr.Column(scale=8, elem_id="right-pane"):
|
199 |
+
with gr.Column(elem_id="initial-popup", visible=False) as example_block:
|
200 |
with gr.Row(scale=1):
|
201 |
with gr.Column(elem_id="initial-popup-left-pane"):
|
202 |
gr.Markdown("GradioChat", elem_id="initial-popup-title")
|
|
|
210 |
with gr.Row():
|
211 |
ex_btn1 = gr.Button("hello world", elem_classes=["example-btn"])
|
212 |
ex_btn2 = gr.Button("what's up?", elem_classes=["example-btn"])
|
213 |
+
ex_btn3 = gr.Button("this is GradioChat", elem_classes=["example-btn"])
|
214 |
|
215 |
chatbot = gr.Chatbot(elem_id='chatbot')
|
216 |
instruction_txtbox = gr.Textbox(
|
|
|
237 |
instruction_txtbox.submit(
|
238 |
add_pingpong,
|
239 |
[idx, local_data, instruction_txtbox],
|
240 |
+
[chatbot, local_data, example_block]
|
241 |
).then(
|
242 |
None, local_data, None,
|
243 |
_js="(v)=>{ setStorage('local_data',v) }"
|