Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,8 +43,14 @@ def modify_system_session(system):
|
|
43 |
system = default_system
|
44 |
return system, system, []
|
45 |
|
46 |
-
def
|
47 |
-
return example
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
# Define example prompts
|
50 |
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."
|
@@ -83,18 +89,9 @@ with gr.Blocks() as demo:
|
|
83 |
submit.click(respond, inputs=[message, chatbot, system_state, max_tokens, temperature, top_p], outputs=[chatbot])
|
84 |
clear_history.click(fn=clear_session, inputs=[], outputs=[message, chatbot])
|
85 |
modify_system.click(fn=modify_system_session, inputs=[system_input], outputs=[system_state, system_input, chatbot])
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
fn=use_example_and_respond,
|
90 |
-
inputs=[lambda: unicorn_example, chatbot, system_state, max_tokens, temperature, top_p],
|
91 |
-
outputs=[message, chatbot]
|
92 |
-
)
|
93 |
-
example2.click(
|
94 |
-
fn=use_example_and_respond,
|
95 |
-
inputs=[lambda: time_travel_example, chatbot, system_state, max_tokens, temperature, top_p],
|
96 |
-
outputs=[message, chatbot]
|
97 |
-
)
|
98 |
|
99 |
gr.Markdown(
|
100 |
"""
|
|
|
43 |
system = default_system
|
44 |
return system, system, []
|
45 |
|
46 |
+
def use_example(example):
|
47 |
+
return example
|
48 |
+
|
49 |
+
def set_unicorn_example():
|
50 |
+
return unicorn_example
|
51 |
+
|
52 |
+
def set_time_travel_example():
|
53 |
+
return time_travel_example
|
54 |
|
55 |
# Define example prompts
|
56 |
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."
|
|
|
89 |
submit.click(respond, inputs=[message, chatbot, system_state, max_tokens, temperature, top_p], outputs=[chatbot])
|
90 |
clear_history.click(fn=clear_session, inputs=[], outputs=[message, chatbot])
|
91 |
modify_system.click(fn=modify_system_session, inputs=[system_input], outputs=[system_state, system_input, chatbot])
|
92 |
+
|
93 |
+
example1.click(fn=set_unicorn_example, inputs=[], outputs=[message])
|
94 |
+
example2.click(fn=set_time_travel_example, inputs=[], outputs=[message])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
gr.Markdown(
|
97 |
"""
|