Spaces:
Running
Running
Commit
·
d999bca
1
Parent(s):
7791c1c
Disabled custom tasks for now due to security risks.
Browse files
app.py
CHANGED
|
@@ -51,12 +51,12 @@ def main():
|
|
| 51 |
def render2(chosen_task):
|
| 52 |
gr.Markdown('**Description**: ' + SCHEMAS[chosen_task]["description"])
|
| 53 |
|
| 54 |
-
custom_task = gr.Checkbox(label="Override Demo Parameters")
|
| 55 |
|
| 56 |
STATE_TRACKER = {}
|
| 57 |
|
| 58 |
-
@gr.render(inputs=[chosen_task
|
| 59 |
-
def render(chosen_task
|
| 60 |
if STATE_TRACKER.get('chosen_task') != chosen_task:
|
| 61 |
STATE_TRACKER['chosen_task'] = chosen_task
|
| 62 |
for k, v in SCHEMAS[chosen_task]['schema'].items():
|
|
@@ -65,7 +65,7 @@ def main():
|
|
| 65 |
else:
|
| 66 |
STATE_TRACKER[k] = json.dumps(v, indent=2)
|
| 67 |
|
| 68 |
-
if custom_task
|
| 69 |
gr.Markdown('#### Custom Demo Parameters')
|
| 70 |
gr.Markdown('You can override the default parameters for the demo. Note: recommended for advanced users only.')
|
| 71 |
gr.Text(label="Description", value=STATE_TRACKER["description"], interactive=True).change(lambda x: STATE_TRACKER.update({'description': x}))
|
|
@@ -197,12 +197,12 @@ Cost of {query_count} queries:
|
|
| 197 |
query_slider.change(render_info, [query_slider, cost_info], [cost_display])
|
| 198 |
|
| 199 |
|
| 200 |
-
def respond(chosen_task,
|
| 201 |
with use_cost_tracker():
|
| 202 |
yield gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), \
|
| 203 |
None, None, None, None, None, None, None, None, None, None, None
|
| 204 |
|
| 205 |
-
if custom_task
|
| 206 |
schema = dict(STATE_TRACKER)
|
| 207 |
for k, v in schema.items():
|
| 208 |
if isinstance(v, str):
|
|
@@ -226,7 +226,7 @@ Cost of {query_count} queries:
|
|
| 226 |
|
| 227 |
yield gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True), cost_data, cost_data_formatted, gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update()
|
| 228 |
|
| 229 |
-
button.click(respond, [chosen_task,
|
| 230 |
|
| 231 |
demo.launch(share=True)
|
| 232 |
|
|
|
|
| 51 |
def render2(chosen_task):
|
| 52 |
gr.Markdown('**Description**: ' + SCHEMAS[chosen_task]["description"])
|
| 53 |
|
| 54 |
+
#custom_task = gr.Checkbox(label="Override Demo Parameters")
|
| 55 |
|
| 56 |
STATE_TRACKER = {}
|
| 57 |
|
| 58 |
+
@gr.render(inputs=[chosen_task])
|
| 59 |
+
def render(chosen_task):
|
| 60 |
if STATE_TRACKER.get('chosen_task') != chosen_task:
|
| 61 |
STATE_TRACKER['chosen_task'] = chosen_task
|
| 62 |
for k, v in SCHEMAS[chosen_task]['schema'].items():
|
|
|
|
| 65 |
else:
|
| 66 |
STATE_TRACKER[k] = json.dumps(v, indent=2)
|
| 67 |
|
| 68 |
+
if False: # custom_task is disabled for now
|
| 69 |
gr.Markdown('#### Custom Demo Parameters')
|
| 70 |
gr.Markdown('You can override the default parameters for the demo. Note: recommended for advanced users only.')
|
| 71 |
gr.Text(label="Description", value=STATE_TRACKER["description"], interactive=True).change(lambda x: STATE_TRACKER.update({'description': x}))
|
|
|
|
| 197 |
query_slider.change(render_info, [query_slider, cost_info], [cost_display])
|
| 198 |
|
| 199 |
|
| 200 |
+
def respond(chosen_task, alice_model, bob_model, query_count):
|
| 201 |
with use_cost_tracker():
|
| 202 |
yield gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), \
|
| 203 |
None, None, None, None, None, None, None, None, None, None, None
|
| 204 |
|
| 205 |
+
if False: # custom_task is disabled for now
|
| 206 |
schema = dict(STATE_TRACKER)
|
| 207 |
for k, v in schema.items():
|
| 208 |
if isinstance(v, str):
|
|
|
|
| 226 |
|
| 227 |
yield gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True), cost_data, cost_data_formatted, gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update()
|
| 228 |
|
| 229 |
+
button.click(respond, [chosen_task, alice_model_dd, bob_model_dd, query_slider], [button, alice_model_dd, bob_model_dd, cost_info, cost_display, chatbot_nl, chatbot_nl_raw, chatbot_negotiation, structured_communication, structured_communication_raw, protocol_result, protocol_hash_result, alice_implementation, bob_implementation])
|
| 230 |
|
| 231 |
demo.launch(share=True)
|
| 232 |
|