Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,83 +27,6 @@ def call_api(message, model, preset):
|
|
| 27 |
except Exception as e:
|
| 28 |
return f"Error: {str(e)}"
|
| 29 |
|
| 30 |
-
# Custom CSS for light mode
|
| 31 |
-
light_css = """
|
| 32 |
-
.gradio-container {
|
| 33 |
-
background-color: #f9f9f9;
|
| 34 |
-
font-family: 'Arial', sans-serif;
|
| 35 |
-
padding: 20px;
|
| 36 |
-
}
|
| 37 |
-
#chatbox {
|
| 38 |
-
background-color: white;
|
| 39 |
-
border-radius: 10px;
|
| 40 |
-
padding: 15px;
|
| 41 |
-
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
| 42 |
-
height: 400px;
|
| 43 |
-
overflow-y: auto;
|
| 44 |
-
}
|
| 45 |
-
#input-container {
|
| 46 |
-
display: flex;
|
| 47 |
-
align-items: center;
|
| 48 |
-
border: 1px solid #ccc;
|
| 49 |
-
border-radius: 20px;
|
| 50 |
-
padding: 5px;
|
| 51 |
-
background-color: white;
|
| 52 |
-
}
|
| 53 |
-
#message-input {
|
| 54 |
-
flex-grow: 1;
|
| 55 |
-
border: none;
|
| 56 |
-
padding: 10px;
|
| 57 |
-
font-size: 14px;
|
| 58 |
-
outline: none;
|
| 59 |
-
margin-right: 5px; /* Add some space between input and button */
|
| 60 |
-
}
|
| 61 |
-
#send-button {
|
| 62 |
-
border: none;
|
| 63 |
-
background: none;
|
| 64 |
-
cursor: pointer;
|
| 65 |
-
padding: 2px; /* Reduced padding for smaller button */
|
| 66 |
-
font-size: 12px;
|
| 67 |
-
width: 30px; /* Adjusted width for smaller button */
|
| 68 |
-
height: 30px; /* Adjusted height for smaller button */
|
| 69 |
-
color: #007BFF;
|
| 70 |
-
transition: opacity 0.3s;
|
| 71 |
-
}
|
| 72 |
-
#send-button:hover {
|
| 73 |
-
opacity: 0.7;
|
| 74 |
-
}
|
| 75 |
-
#settings-container {
|
| 76 |
-
margin-top: 20px;
|
| 77 |
-
}
|
| 78 |
-
"""
|
| 79 |
-
|
| 80 |
-
# Dark mode CSS
|
| 81 |
-
dark_css = """
|
| 82 |
-
.gradio-container {
|
| 83 |
-
background-color: #1e1e1e; /* Dark background */
|
| 84 |
-
color: white; /* Light text color */
|
| 85 |
-
}
|
| 86 |
-
#chatbox {
|
| 87 |
-
background-color: #2e2e2e; /* Dark chatbox */
|
| 88 |
-
color: white; /* Light text color */
|
| 89 |
-
}
|
| 90 |
-
#input-container {
|
| 91 |
-
background-color: #2e2e2e; /* Dark input container */
|
| 92 |
-
border: 1px solid #444; /* Dark border */
|
| 93 |
-
}
|
| 94 |
-
#message-input {
|
| 95 |
-
background-color: #3e3e3e; /* Dark input field */
|
| 96 |
-
color: white; /* Light text color */
|
| 97 |
-
}
|
| 98 |
-
#send-button {
|
| 99 |
-
color: #007BFF; /* Button text color */
|
| 100 |
-
}
|
| 101 |
-
"""
|
| 102 |
-
|
| 103 |
-
# Function to toggle dark mode
|
| 104 |
-
def toggle_dark_mode(is_dark):
|
| 105 |
-
return dark_css if is_dark else light_css
|
| 106 |
-
|
| 107 |
# Create Gradio interface
|
| 108 |
def create_interface():
|
| 109 |
with gr.Blocks() as demo:
|
|
@@ -113,12 +36,12 @@ def create_interface():
|
|
| 113 |
chatbox = gr.Textbox(label="", interactive=False, elem_id="chatbox", lines=12)
|
| 114 |
|
| 115 |
# Input field with button inside
|
| 116 |
-
with gr.Row(
|
| 117 |
-
message = gr.Textbox(placeholder="Type a message...",
|
| 118 |
-
send_btn = gr.Button("➤", elem_id="send-button")
|
| 119 |
|
| 120 |
# Settings section
|
| 121 |
-
with gr.Accordion("⚙️ Settings", open=False
|
| 122 |
model = gr.Dropdown(choices=["Lake 1 Base"], label="Model", value="Lake 1 Base")
|
| 123 |
preset = gr.Dropdown(choices=["Fast", "Normal", "Quality", "Unreal Performance"], label="Preset", value="Fast")
|
| 124 |
dark_mode = gr.Checkbox(label="Enable Dark Mode", value=False)
|
|
|
|
| 27 |
except Exception as e:
|
| 28 |
return f"Error: {str(e)}"
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
# Create Gradio interface
|
| 31 |
def create_interface():
|
| 32 |
with gr.Blocks() as demo:
|
|
|
|
| 36 |
chatbox = gr.Textbox(label="", interactive=False, elem_id="chatbox", lines=12)
|
| 37 |
|
| 38 |
# Input field with button inside
|
| 39 |
+
with gr.Row():
|
| 40 |
+
message = gr.Textbox(placeholder="Type a message...", lines=1, show_label=False)
|
| 41 |
+
send_btn = gr.Button("➤", elem_id="send-button", scale=0.5) # Use scale to make the button smaller
|
| 42 |
|
| 43 |
# Settings section
|
| 44 |
+
with gr.Accordion("⚙️ Settings", open=False):
|
| 45 |
model = gr.Dropdown(choices=["Lake 1 Base"], label="Model", value="Lake 1 Base")
|
| 46 |
preset = gr.Dropdown(choices=["Fast", "Normal", "Quality", "Unreal Performance"], label="Preset", value="Fast")
|
| 47 |
dark_mode = gr.Checkbox(label="Enable Dark Mode", value=False)
|