Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -88,20 +88,6 @@ def generate(prompt, history, system_prompt, temperature=0.9, max_new_tokens=904
|
|
88 |
output += response.token.text
|
89 |
yield output
|
90 |
|
91 |
-
additional_inputs = [
|
92 |
-
gr.Textbox(label="System Prompt", max_lines=1, interactive=True),
|
93 |
-
gr.Slider(label="Temperature", value=0.9, minimum=0.0, maximum=1.0, step=0.05, interactive=True, info="Higher values produce more diverse outputs"),
|
94 |
-
gr.Slider(label="Max new tokens", value=9048, minimum=256, maximum=9048, step=64, interactive=True, info="The maximum numbers of new tokens"),
|
95 |
-
gr.Slider(label="Top-p (nucleus sampling)", value=0.90, minimum=0.0, maximum=1, step=0.05, interactive=True, info="Higher values sample more low-probability tokens"),
|
96 |
-
gr.Slider(label="Repetition penalty", value=1.2, minimum=1.0, maximum=2.0, step=0.05, interactive=True, info="Penalize repeated tokens")
|
97 |
-
]
|
98 |
-
|
99 |
-
def check_keywords(text):
|
100 |
-
for keyword, _ in system_prompt_templates.items():
|
101 |
-
if re.search(keyword, text, re.IGNORECASE):
|
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():
|
@@ -110,7 +96,13 @@ with gr.Blocks() as demo:
|
|
110 |
with gr.Column(scale=1):
|
111 |
submit_button = gr.Button("Send")
|
112 |
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
fn=generate,
|
115 |
inputs=[user_input, chatbot, gr.Textbox(label="System Prompt", max_lines=1, interactive=True)],
|
116 |
outputs=chatbot,
|
|
|
88 |
output += response.token.text
|
89 |
yield output
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
with gr.Blocks() as demo:
|
92 |
chatbot = gr.Chatbot(show_label=True, show_share_button=False, show_copy_button=True, likeable=True, layout="panel")
|
93 |
with gr.Row():
|
|
|
96 |
with gr.Column(scale=1):
|
97 |
submit_button = gr.Button("Send")
|
98 |
|
99 |
+
def check_keywords(text):
|
100 |
+
for keyword, _ in system_prompt_templates.items():
|
101 |
+
if re.search(keyword, text, re.IGNORECASE):
|
102 |
+
return True
|
103 |
+
return False
|
104 |
+
|
105 |
+
user_input.submit(
|
106 |
fn=generate,
|
107 |
inputs=[user_input, chatbot, gr.Textbox(label="System Prompt", max_lines=1, interactive=True)],
|
108 |
outputs=chatbot,
|