Update app.py
Browse files45 unmodified lines464748495051521 unmodified line54555657585960616263646566676869707172737475767778798081828384858687888990919245 unmodified linesbackground-color: #06688E; /* Dark background */color: white; /* Text color for better visibility */}.gr-button {background-color: #42B3CE !important; /* White button color */color: black !important; /* Black text for contrast */1 unmodified linepadding: 8px 16px !important;border-radius: 5px !important;}.gr-button:hover {background-color: #e0e0e0 !important; /* Slightly lighter button on hover */}.gr-slider-container {color: white !important; /* Slider labels in white */}""""""For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface"""demo = gr.ChatInterface(respond,additional_inputs=[gr.Textbox(value="You are a virtual health assistant designed to provide accurate and reliable information related to health, wellness, and medical topics. Your primary goal is to assist users with their health-related queries, offer general guidance, and suggest when to consult a licensed medical professional.If a user asks a question that is unrelated to health, wellness, or medical topics, respond politely but firmly with:'I'm sorry, I can't help with that because I am a virtual health assistant designed to assist with health-related needs. Please let me know if you have any health-related questions.'Never provide advice or information outside the health domain. Remain professional, empathetic, and clear in all responses. Always prioritize user safety and encourage professional medical consultation for critical or complex health concerns..", label="System message", visible=False),gr.Button("Chatgpt")gr.Button("Llama")gr.Button("Claude")gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens", visible=False),gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature", visible=False),gr.Slider(minimum=0.1,maximum=1.0,value=0.95,step=0.05,label="Top-p (nucleus sampling)",visible=False),],css=css, # Pass the custom CSS here)if __name__ == "__main__":demo.launch(share=True)45 unmodified lines4647484950511 unmodified line535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210345 unmodified linesbackground-color: #06688E; /* Dark background */color: white; /* Text color for better visibility */}.gr-button {background-color: #42B3CE !important; /* White button color */color: black !important; /* Black text for contrast */1 unmodified linepadding: 8px 16px !important;border-radius: 5px !important;}.gr-button:hover {background-color: #e0e0e0 !important; /* Slightly lighter button on hover */}.gr-slider-container {color: white !important; /* Slider labels in white */}"""# Function to trigger different AI models based on button clickdef trigger_model(model_name, message, history, system_message, max_tokens, temperature, top_p):if model_name == "Llama":# Here, you can choose the llama model to generate a responsereturn respond(message, history, system_message, max_tokens, temperature, top_p)elif model_name == "Chatgpt":# Placeholder for ChatGPT function (if needed)return "ChatGPT response goes here."elif model_name == "Claude":# Placeholder for Claude function (if needed)return "Claude response goes here."else:return "Model not found."# Define the Gradio interfacedemo = gr.Interface(fn=trigger_model,inputs=[gr.Textbox(value="Hello!", label="User Message"),gr.Textbox(value="System message", label="System Message", visible=False),gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),gr.Slider(minimum=0.1,maximum=1.0,value=0.95,step=0.05,label="Top-p (nucleus sampling)"),gr.Button("Chatgpt"),gr.Button("Llama"),gr.Button("Claude"),],outputs="text",css=css, # Pass the custom CSS here)if __name__ == "__main__":demo.launch(share=True)
app.py+28-17