Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,7 @@ system_prompt_templates = {
|
|
16 |
r"\btime\b|\bhour\b|\bclock\b": "server log: ~This message was sent at {formatted_time}. The actual year is 2024.~",
|
17 |
r"\bweather\b|\bforecast\b|\bmeteo": "server log: ~The current weather conditions in {city_name} are {weather_description} with a high of {current_temperature_c}°C ({current_temperature_f}°F) and a pressure of {current_pressure_hpa} hPa ({current_pressure_inHg} inHg) and humidity of {current_humidity}%.~",
|
18 |
r"\bdate\b|\bcalendar\b": "server log: ~Today's date is {formatted_date}.~",
|
|
|
19 |
}
|
20 |
|
21 |
def format_prompt(message, history, system_prompt):
|
@@ -101,23 +102,20 @@ def check_keywords(text):
|
|
101 |
return True
|
102 |
return False
|
103 |
|
104 |
-
|
105 |
-
|
106 |
with gr.Row():
|
107 |
with gr.Column(scale=3):
|
108 |
user_input = gr.Textbox(label="Your message", placeholder="Type your message here...")
|
109 |
with gr.Column(scale=1):
|
110 |
submit_button = gr.Button("Send")
|
111 |
|
112 |
-
with gr.Row():
|
113 |
-
chatbot_output = chatbot
|
114 |
-
|
115 |
submit_button.click(
|
116 |
fn=generate,
|
117 |
inputs=[user_input, chatbot, gr.Textbox(label="System Prompt", max_lines=1, interactive=True)],
|
118 |
-
outputs=
|
119 |
every=200,
|
120 |
-
_js=
|
121 |
)
|
122 |
|
123 |
-
|
|
|
16 |
r"\btime\b|\bhour\b|\bclock\b": "server log: ~This message was sent at {formatted_time}. The actual year is 2024.~",
|
17 |
r"\bweather\b|\bforecast\b|\bmeteo": "server log: ~The current weather conditions in {city_name} are {weather_description} with a high of {current_temperature_c}°C ({current_temperature_f}°F) and a pressure of {current_pressure_hpa} hPa ({current_pressure_inHg} inHg) and humidity of {current_humidity}%.~",
|
18 |
r"\bdate\b|\bcalendar\b": "server log: ~Today's date is {formatted_date}.~",
|
19 |
+
r"\bpolitics\b|\belection\b": "server log: ~This conversation is taking place in a politically neutral environment.~"
|
20 |
}
|
21 |
|
22 |
def format_prompt(message, history, system_prompt):
|
|
|
102 |
return True
|
103 |
return False
|
104 |
|
105 |
+
with gr.Blocks() as demo:
|
106 |
+
chatbot = gr.Chatbot(show_label=True, show_share_button=False, show_copy_button=True, likeable=True, layout="panel")
|
107 |
with gr.Row():
|
108 |
with gr.Column(scale=3):
|
109 |
user_input = gr.Textbox(label="Your message", placeholder="Type your message here...")
|
110 |
with gr.Column(scale=1):
|
111 |
submit_button = gr.Button("Send")
|
112 |
|
|
|
|
|
|
|
113 |
submit_button.click(
|
114 |
fn=generate,
|
115 |
inputs=[user_input, chatbot, gr.Textbox(label="System Prompt", max_lines=1, interactive=True)],
|
116 |
+
outputs=chatbot,
|
117 |
every=200,
|
118 |
+
_js=None
|
119 |
)
|
120 |
|
121 |
+
demo.launch(show_api=False)
|