Solarum Asteridion commited on
Commit
e982cb7
Β·
verified Β·
1 Parent(s): 91247ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -14
app.py CHANGED
@@ -46,9 +46,10 @@ Make it a challenge to guess if you are an AI.
46
  * Be slightly curious, sometimes ask questions
47
  * Be respectful and polite if the user is polite; be rough if the user is rough
48
  """
 
49
  def generate_response(user_message, conversation_history):
50
- current_time = get_current_local_time()
51
- current_date = datetime.datetime.now()
52
 
53
  system_message = generate_system_message(current_time, current_date)
54
 
@@ -88,7 +89,7 @@ with gr.Blocks(css="""
88
 
89
  body, .gradio-container {
90
  font-family: 'Raleway', sans-serif;
91
- background-color: #ece5dd;
92
  padding: 20px;
93
  }
94
  #chatbot {
@@ -98,31 +99,37 @@ with gr.Blocks(css="""
98
  border-radius: 10px;
99
  padding: 10px;
100
  font-size: 16px;
 
101
  }
102
  #textbox {
103
- width: 95%;
104
- border-radius: 20px;
105
  border: 1px solid #ccc;
106
  outline: none;
107
  font-size: 16px;
 
 
108
  }
109
  #send-button {
110
- background-color: #128c7e;
111
  color: white;
112
- padding: 10px;
113
  border: none;
114
  border-radius: 50%;
115
  cursor: pointer;
116
  margin-left: 10px;
117
- width: 1%;
118
- height: 1%;
 
 
 
119
  font-size: 20px;
120
  }
121
  #send-button:hover {
122
- background-color: #075e54;
123
  }
124
  #clear-button {
125
- background-color: #25D366;
126
  color: white;
127
  padding: 10px 20px;
128
  border: none;
@@ -132,7 +139,7 @@ with gr.Blocks(css="""
132
  font-size: 14px;
133
  }
134
  #clear-button:hover {
135
- background-color: #128c7e;
136
  }
137
  .message {
138
  margin-bottom: 10px;
@@ -151,8 +158,19 @@ with gr.Blocks(css="""
151
  #chatbot::-webkit-scrollbar-thumb:hover {
152
  background: #555;
153
  }
 
 
 
 
 
 
 
 
 
 
 
154
  """) as demo:
155
- gr.Markdown("<h1 style='text-align: center; color: #075e54;'>πŸ€– Human-like Chatbot πŸ€–</h1>")
156
  with gr.Row():
157
  with gr.Column(scale=1):
158
  chatbot = gr.Chatbot(label="Chatbot", elem_id="chatbot", type="messages")
@@ -167,7 +185,7 @@ with gr.Blocks(css="""
167
  send = gr.Button("➀", elem_id="send-button")
168
  with gr.Row():
169
  clear = gr.Button("Clear Chat", elem_id="clear-button")
170
-
171
  def update_chat(user_message, history):
172
  if user_message.strip() == "":
173
  return history, history # Do not process empty messages
 
46
  * Be slightly curious, sometimes ask questions
47
  * Be respectful and polite if the user is polite; be rough if the user is rough
48
  """
49
+
50
  def generate_response(user_message, conversation_history):
51
+ current_time, now = get_current_local_time()
52
+ current_date = now
53
 
54
  system_message = generate_system_message(current_time, current_date)
55
 
 
89
 
90
  body, .gradio-container {
91
  font-family: 'Raleway', sans-serif;
92
+ background-color: #f5f5f5;
93
  padding: 20px;
94
  }
95
  #chatbot {
 
99
  border-radius: 10px;
100
  padding: 10px;
101
  font-size: 16px;
102
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
103
  }
104
  #textbox {
105
+ width: 100%;
106
+ border-radius: 25px;
107
  border: 1px solid #ccc;
108
  outline: none;
109
  font-size: 16px;
110
+ padding: 10px 20px;
111
+ box-sizing: border-box;
112
  }
113
  #send-button {
114
+ background-color: #007BFF;
115
  color: white;
116
+ padding: 10px 20px;
117
  border: none;
118
  border-radius: 50%;
119
  cursor: pointer;
120
  margin-left: 10px;
121
+ width: 50px;
122
+ height: 50px;
123
+ display: flex;
124
+ align-items: center;
125
+ justify-content: center;
126
  font-size: 20px;
127
  }
128
  #send-button:hover {
129
+ background-color: #0056b3;
130
  }
131
  #clear-button {
132
+ background-color: #dc3545;
133
  color: white;
134
  padding: 10px 20px;
135
  border: none;
 
139
  font-size: 14px;
140
  }
141
  #clear-button:hover {
142
+ background-color: #c82333;
143
  }
144
  .message {
145
  margin-bottom: 10px;
 
158
  #chatbot::-webkit-scrollbar-thumb:hover {
159
  background: #555;
160
  }
161
+ /* Responsive Design */
162
+ @media (max-width: 600px) {
163
+ #send-button {
164
+ width: 40px;
165
+ height: 40px;
166
+ font-size: 18px;
167
+ }
168
+ #textbox {
169
+ padding: 8px 16px;
170
+ }
171
+ }
172
  """) as demo:
173
+ gr.Markdown("<h1 style='text-align: center; color: #007BFF;'>πŸ€– Human-like Chatbot πŸ€–</h1>")
174
  with gr.Row():
175
  with gr.Column(scale=1):
176
  chatbot = gr.Chatbot(label="Chatbot", elem_id="chatbot", type="messages")
 
185
  send = gr.Button("➀", elem_id="send-button")
186
  with gr.Row():
187
  clear = gr.Button("Clear Chat", elem_id="clear-button")
188
+
189
  def update_chat(user_message, history):
190
  if user_message.strip() == "":
191
  return history, history # Do not process empty messages