Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -69,7 +69,7 @@ def load_pipeline(model_name):
|
|
| 69 |
return pipe
|
| 70 |
|
| 71 |
|
| 72 |
-
def retrieve_context(query, max_results=6, max_chars=
|
| 73 |
"""
|
| 74 |
Retrieve search snippets from DuckDuckGo (runs in background).
|
| 75 |
Returns a list of result strings.
|
|
@@ -248,7 +248,7 @@ def update_default_prompt(enable_search):
|
|
| 248 |
# ------------------------------
|
| 249 |
# Gradio UI
|
| 250 |
# ------------------------------
|
| 251 |
-
with gr.Blocks(title="Yee
|
| 252 |
gr.Markdown("## Yee-R1 Demo")
|
| 253 |
gr.Markdown("小熠(Yee)AI 数据安全专家")
|
| 254 |
with gr.Row():
|
|
@@ -257,8 +257,8 @@ with gr.Blocks(title="Yee-R1-Demo") as demo:
|
|
| 257 |
search_chk = gr.Checkbox(label="Enable Web Search", value=True)
|
| 258 |
sys_prompt = gr.Textbox(label="System Prompt", lines=3, value=update_default_prompt(search_chk.value))
|
| 259 |
gr.Markdown("### Generation Parameters")
|
| 260 |
-
max_tok = gr.Slider(64, 16384, value=
|
| 261 |
-
temp = gr.Slider(0.1, 2.0, value=0.
|
| 262 |
k = gr.Slider(1, 100, value=40, step=1, label="Top-K")
|
| 263 |
p = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Top-P")
|
| 264 |
rp = gr.Slider(1.0, 2.0, value=1.2, step=0.1, label="Repetition Penalty")
|
|
@@ -269,7 +269,7 @@ with gr.Blocks(title="Yee-R1-Demo") as demo:
|
|
| 269 |
clr = gr.Button("Clear Chat")
|
| 270 |
cnl = gr.Button("Cancel Generation")
|
| 271 |
with gr.Column(scale=7):
|
| 272 |
-
chat = gr.Chatbot(type="messages"
|
| 273 |
txt = gr.Textbox(placeholder="Type your message and press Enter...")
|
| 274 |
dbg = gr.Markdown()
|
| 275 |
|
|
@@ -280,4 +280,4 @@ with gr.Blocks(title="Yee-R1-Demo") as demo:
|
|
| 280 |
inputs=[txt, chat, sys_prompt, search_chk, mr, mc,
|
| 281 |
model_dd, max_tok, temp, k, p, rp, st],
|
| 282 |
outputs=[chat, dbg])
|
| 283 |
-
demo.launch()
|
|
|
|
| 69 |
return pipe
|
| 70 |
|
| 71 |
|
| 72 |
+
def retrieve_context(query, max_results=6, max_chars=600):
|
| 73 |
"""
|
| 74 |
Retrieve search snippets from DuckDuckGo (runs in background).
|
| 75 |
Returns a list of result strings.
|
|
|
|
| 248 |
# ------------------------------
|
| 249 |
# Gradio UI
|
| 250 |
# ------------------------------
|
| 251 |
+
with gr.Blocks(title="Yee R1 Demo") as demo:
|
| 252 |
gr.Markdown("## Yee-R1 Demo")
|
| 253 |
gr.Markdown("小熠(Yee)AI 数据安全专家")
|
| 254 |
with gr.Row():
|
|
|
|
| 257 |
search_chk = gr.Checkbox(label="Enable Web Search", value=True)
|
| 258 |
sys_prompt = gr.Textbox(label="System Prompt", lines=3, value=update_default_prompt(search_chk.value))
|
| 259 |
gr.Markdown("### Generation Parameters")
|
| 260 |
+
max_tok = gr.Slider(64, 16384, value=2048, step=32, label="Max Tokens")
|
| 261 |
+
temp = gr.Slider(0.1, 2.0, value=0.7, step=0.1, label="Temperature")
|
| 262 |
k = gr.Slider(1, 100, value=40, step=1, label="Top-K")
|
| 263 |
p = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Top-P")
|
| 264 |
rp = gr.Slider(1.0, 2.0, value=1.2, step=0.1, label="Repetition Penalty")
|
|
|
|
| 269 |
clr = gr.Button("Clear Chat")
|
| 270 |
cnl = gr.Button("Cancel Generation")
|
| 271 |
with gr.Column(scale=7):
|
| 272 |
+
chat = gr.Chatbot(type="messages")
|
| 273 |
txt = gr.Textbox(placeholder="Type your message and press Enter...")
|
| 274 |
dbg = gr.Markdown()
|
| 275 |
|
|
|
|
| 280 |
inputs=[txt, chat, sys_prompt, search_chk, mr, mc,
|
| 281 |
model_dd, max_tok, temp, k, p, rp, st],
|
| 282 |
outputs=[chat, dbg])
|
| 283 |
+
demo.launch()
|