Spaces:
Sleeping
Sleeping
Update app.py
Browse files68 unmodified lines69707172737475172 unmodified lines2482492502512522532542 unmodified lines2572582592602612622632644 unmodified lines2692702712722732742754 unmodified lines28028128228368 unmodified linesreturn pipedef retrieve_context(query, max_results=6, max_chars=1000):"""Retrieve search snippets from DuckDuckGo (runs in background).Returns a list of result strings.172 unmodified lines# ------------------------------# Gradio UI# ------------------------------with gr.Blocks(title="Yee-R1-Demo") as demo:gr.Markdown("## Yee-R1 Demo")gr.Markdown("小熠(Yee)AI 数据安全专家")with gr.Row():2 unmodified linessearch_chk = gr.Checkbox(label="Enable Web Search", value=True)sys_prompt = gr.Textbox(label="System Prompt", lines=3, value=update_default_prompt(search_chk.value))gr.Markdown("### Generation Parameters")max_tok = gr.Slider(64, 16384, value=4096, step=32, label="Max Tokens")temp = gr.Slider(0.1, 2.0, value=0.6, step=0.1, label="Temperature")k = gr.Slider(1, 100, value=40, step=1, label="Top-K")p = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Top-P")rp = gr.Slider(1.0, 2.0, value=1.2, step=0.1, label="Repetition Penalty")4 unmodified linesclr = gr.Button("Clear Chat")cnl = gr.Button("Cancel Generation")with gr.Column(scale=7):chat = gr.Chatbot(type="messages", show_copy_all_button=True)txt = gr.Textbox(placeholder="Type your message and press Enter...")dbg = gr.Markdown()4 unmodified linesinputs=[txt, chat, sys_prompt, search_chk, mr, mc,model_dd, max_tok, temp, k, p, rp, st],outputs=[chat, dbg])demo.launch()68 unmodified lines69707172737475172 unmodified lines2482492502512522532542 unmodified lines2572582592602612622632644 unmodified lines2692702712722732742754 unmodified lines28028128228368 unmodified linesreturn pipedef retrieve_context(query, max_results=6, max_chars=600):"""Retrieve search snippets from DuckDuckGo (runs in background).Returns a list of result strings.172 unmodified lines# ------------------------------# Gradio UI# ------------------------------with gr.Blocks(title="Yee R1 Demo") as demo:gr.Markdown("## Yee-R1 Demo")gr.Markdown("小熠(Yee)AI 数据安全专家")with gr.Row():2 unmodified linessearch_chk = gr.Checkbox(label="Enable Web Search", value=True)sys_prompt = gr.Textbox(label="System Prompt", lines=3, value=update_default_prompt(search_chk.value))gr.Markdown("### Generation Parameters")max_tok = gr.Slider(64, 16384, value=2048, step=32, label="Max Tokens")temp = gr.Slider(0.1, 2.0, value=0.7, step=0.1, label="Temperature")k = gr.Slider(1, 100, value=40, step=1, label="Top-K")p = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Top-P")rp = gr.Slider(1.0, 2.0, value=1.2, step=0.1, label="Repetition Penalty")4 unmodified linesclr = gr.Button("Clear Chat")cnl = gr.Button("Cancel Generation")with gr.Column(scale=7):chat = gr.Chatbot(type="messages")txt = gr.Textbox(placeholder="Type your message and press Enter...")dbg = gr.Markdown()4 unmodified linesinputs=[txt, chat, sys_prompt, search_chk, mr, mc,model_dd, max_tok, temp, k, p, rp, st],outputs=[chat, dbg])demo.launch()
app.py+6-6