BICORP commited on
Commit
86c06a7
·
verified ·
1 Parent(s): d647891

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -5
app.py CHANGED
@@ -27,6 +27,39 @@ def call_api(message, model, preset):
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,11 +69,9 @@ def create_interface():
36
  chatbox = gr.Textbox(label="", interactive=False, elem_id="chatbox", lines=12)
37
 
38
  # Input field with button inside
39
- with gr.Row():
40
- with gr.Column(scale=1): # Input field takes most of the space
41
- message = gr.Textbox(placeholder="Type a message...", lines=1, show_label=False)
42
- with gr.Column(scale=0): # Button takes minimal space
43
- send_btn = gr.Button("➤", elem_id="send-button", scale=0.5) # Smaller button
44
 
45
  # Settings section
46
  with gr.Accordion("⚙️ Settings", open=False):
 
27
  except Exception as e:
28
  return f"Error: {str(e)}"
29
 
30
+ # Dark mode CSS
31
+ dark_css = """
32
+ .gradio-container {
33
+ background-color: #1e1e1e; /* Dark background */
34
+ color: white; /* Light text color */
35
+ }
36
+ #chatbox {
37
+ background-color: #2e2e2e; /* Dark chatbox */
38
+ color: white; /* Light text color */
39
+ }
40
+ #input-container {
41
+ background-color: #2e2e2e; /* Dark input container */
42
+ border: 1px solid #444; /* Dark border */
43
+ border-radius: 20px; /* Rounded corners */
44
+ }
45
+ #message-input {
46
+ background-color: #3e3e3e; /* Dark input field */
47
+ color: white; /* Light text color */
48
+ }
49
+ #send-button {
50
+ color: #007BFF; /* Button text color */
51
+ border: none; /* No border */
52
+ background: none; /* No background */
53
+ cursor: pointer; /* Pointer cursor */
54
+ padding: 0; /* No padding */
55
+ margin-left: -5px; /* Overlap with input */
56
+ }
57
+ """
58
+
59
+ # Function to toggle dark mode
60
+ def toggle_dark_mode(is_dark):
61
+ return dark_css if is_dark else ""
62
+
63
  # Create Gradio interface
64
  def create_interface():
65
  with gr.Blocks() as demo:
 
69
  chatbox = gr.Textbox(label="", interactive=False, elem_id="chatbox", lines=12)
70
 
71
  # Input field with button inside
72
+ with gr.Row(elem_id="input-container"):
73
+ message = gr.Textbox(placeholder="Type a message...", elem_id="message-input", lines=1, show_label=False)
74
+ send_btn = gr.Button("", elem_id="send-button") # Button inside the input box
 
 
75
 
76
  # Settings section
77
  with gr.Accordion("⚙️ Settings", open=False):