Spaces:
Build error
Build error
Update app.py
Browse files26 unmodified lines272829303132333430 unmodified lines656667686970717273747 unmodified lines82838485868788899013 unmodified lines10410510610710810926 unmodified linesexcept Exception as e:return f"Error: {str(e)}"# Custom CSS for clean UIcss = """.gradio-container {background-color: #f9f9f9;font-family: 'Arial', sans-serif;30 unmodified linesborder: none;background: none;cursor: pointer;padding: 5px; /* Reduced padding for a smaller button */font-size: 12px; /* Smaller font size */width: 30px; /* Set a specific width */height: 30px; /* Set a specific height */color: #007BFF; /* Text color */transition: opacity 0.3s; /* Smooth transition for hover effect */}7 unmodified lines}"""# Create Gradio interfacedef create_interface():with gr.Blocks(css=css) as demo:gr.Markdown("## 💬 Chatbot")# Chat display area13 unmodified lines# Button click eventsend_btn.click(call_api, inputs=[message, model, preset], outputs=chatbox)return demo# Launch the interface26 unmodified lines272829303132333430 unmodified lines656667686970717273747 unmodified lines82838485868788899091929394959697989910010110210310410510610710810911011111211311411511611713 unmodified lines13113213313413513613713813926 unmodified linesexcept Exception as e:return f"Error: {str(e)}"# Custom CSS for light modelight_css = """.gradio-container {background-color: #f9f9f9;font-family: 'Arial', sans-serif;30 unmodified linesborder: none;background: none;cursor: pointer;padding: 2px; /* Reduced padding for a smaller button */font-size: 10px; /* Smaller font size */width: 20px; /* Set a specific width */height: 20px; /* Set a specific height */color: #007BFF; /* Text color */transition: opacity 0.3s; /* Smooth transition for hover effect */}7 unmodified lines}"""# Dark mode CSSdark_css = """.dark-mode .gradio-container {background-color: #1e1e1e; /* Dark background */color: white; /* Light text color */}.dark-mode #chatbox {background-color: #2e2e2e; /* Dark chatbox */color: white; /* Light text color */}.dark-mode #input-container {background-color: #2e2e2e; /* Dark input container */border: 1px solid #444; /* Dark border */}.dark-mode #message-input {background-color: #3e3e3e; /* Dark input field */color: white; /* Light text color */}.dark-mode #send-button {color: #007BFF; /* Button text color */}"""# Create Gradio interfacedef create_interface():with gr.Blocks() as demo:gr.Markdown("## 💬 Chatbot")# Chat display area13 unmodified lines# Button click eventsend_btn.click(call_api, inputs=[message, model, preset], outputs=chatbox)# Toggle dark modedark_mode.change(lambda x: demo.css = dark_css if x else light_css, inputs=[dark_mode])return demo# Launch the interface
app.py+37-7