Update app.py
Browse files9 unmodified lines101112131415161718192021222324252627282910 unmodified lines40414243444546474849505152538 unmodified lines626364659 unmodified linesdeepseek_r1 = load_model("DeepSeek-R1")deepseek_r1_zero = load_model("DeepSeek-R1-Zero")# Disable API names for all functions (Gradio doesn't natively use `fns`)# Adjust this section if specific API name disabling logic is required.# Define the optional parameters sectiondef create_optional_parameters():with gr.Accordion("Optional Parameters (Click to Expand)", open=False):system_message = gr.Textbox(label="System Message",value="You are a friendly Chatbot created by ruslanmv.com",lines=2)max_new_tokens = gr.Slider(minimum=1, maximum=4000, value=200, label="Max New Tokens")temperature = gr.Slider(minimum=0.10, maximum=4.00, value=0.70, label="Temperature")top_p = gr.Slider(minimum=0.10, maximum=1.00, value=0.90, label="Top-p (nucleus sampling)")return system_message, max_new_tokens, temperature, top_p# Define the main interface10 unmodified linesreturn response# Create the Gradio interfacewith gr.Blocks() as demo:gr.Markdown("# DeepSeek Chatbot\nCreated by [ruslanmv.com](https://ruslanmv.com/)")with gr.Row():with gr.Column():user_input = gr.Textbox(label="Your Message", placeholder="Type your message here...", lines=3)submit_button = gr.Button("Submit", variant="primary")with gr.Column():output = gr.Markdown(label="Chatbot Response")# Add the optional parameters section8 unmodified lines# Launch the demoif __name__ == "__main__":demo.launch()9 unmodified lines10111213141516171819202122232425262710 unmodified lines3839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828 unmodified lines919293949 unmodified linesdeepseek_r1 = load_model("DeepSeek-R1")deepseek_r1_zero = load_model("DeepSeek-R1-Zero")# Define the optional parameters sectiondef create_optional_parameters():with gr.Accordion("Optional Parameters (Click to Expand)", open=False):system_message = gr.Textbox(label="System Message",value="You are a friendly Chatbot created by ruslanmv.com",lines=2,interactive=True)max_new_tokens = gr.Slider(minimum=1, maximum=4000, value=200, label="Max New Tokens", interactive=True)temperature = gr.Slider(minimum=0.10, maximum=4.00, value=0.70, label="Temperature", interactive=True)top_p = gr.Slider(minimum=0.10, maximum=1.00, value=0.90, label="Top-p (nucleus sampling)", interactive=True)return system_message, max_new_tokens, temperature, top_p# Define the main interface10 unmodified linesreturn response# Create the Gradio interfacewith gr.Blocks(css=""".gradio-container {font-family: Arial, sans-serif;background-color: #f9f9f9;color: #333;padding: 20px;}.gr-button.primary {background-color: #4caf50;color: white;border: none;padding: 10px 20px;font-size: 16px;border-radius: 5px;cursor: pointer;}.gr-button.primary:hover {background-color: #45a049;}.gr-textbox textarea {font-size: 16px;}""") as demo:gr.Markdown("""# DeepSeek ChatbotWelcome to the **DeepSeek Chatbot**! This AI-powered chatbot is designed to provide insightful responses.Created by [ruslanmv.com](https://ruslanmv.com/).""")with gr.Row():with gr.Column(scale=3):user_input = gr.Textbox(label="Your Message",placeholder="Type your message here...",lines=4,interactive=True)submit_button = gr.Button("Send", variant="primary")with gr.Column(scale=5):output = gr.Markdown(label="Chatbot Response")# Add the optional parameters section8 unmodified lines# Launch the demoif __name__ == "__main__":demo.launch()
app.py+43-14