Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,6 +41,12 @@ def modify_system_session(system):
|
|
| 41 |
def use_example(example):
|
| 42 |
return example
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
# Define example prompts
|
| 45 |
unicorn_example = "In a shocking finding, scientist discovered a herd of unicorns living in a remote, previously unexplored valley, in the Andes Mountains. Even more surprising to the researchers was the fact that the unicorns spoke perfect English."
|
| 46 |
time_travel_example = "Explain the grandfather paradox in time travel and propose a potential resolution."
|
|
@@ -79,9 +85,8 @@ with gr.Blocks() as demo:
|
|
| 79 |
clear_history.click(fn=clear_session, inputs=[], outputs=[message, chatbot])
|
| 80 |
modify_system.click(fn=modify_system_session, inputs=[system_input], outputs=[system_state, system_input, chatbot])
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
example2.click(fn=use_example, inputs=[], outputs=[message], _js=f"() => '{time_travel_example}'")
|
| 85 |
|
| 86 |
gr.Markdown(
|
| 87 |
"""
|
|
|
|
| 41 |
def use_example(example):
|
| 42 |
return example
|
| 43 |
|
| 44 |
+
def set_unicorn_example():
|
| 45 |
+
return unicorn_example
|
| 46 |
+
|
| 47 |
+
def set_time_travel_example():
|
| 48 |
+
return time_travel_example
|
| 49 |
+
|
| 50 |
# Define example prompts
|
| 51 |
unicorn_example = "In a shocking finding, scientist discovered a herd of unicorns living in a remote, previously unexplored valley, in the Andes Mountains. Even more surprising to the researchers was the fact that the unicorns spoke perfect English."
|
| 52 |
time_travel_example = "Explain the grandfather paradox in time travel and propose a potential resolution."
|
|
|
|
| 85 |
clear_history.click(fn=clear_session, inputs=[], outputs=[message, chatbot])
|
| 86 |
modify_system.click(fn=modify_system_session, inputs=[system_input], outputs=[system_state, system_input, chatbot])
|
| 87 |
|
| 88 |
+
example1.click(fn=set_unicorn_example, inputs=[], outputs=[message])
|
| 89 |
+
example2.click(fn=set_time_travel_example, inputs=[], outputs=[message])
|
|
|
|
| 90 |
|
| 91 |
gr.Markdown(
|
| 92 |
"""
|