Rohith1112 commited on
Commit
00b2c87
·
verified ·
1 Parent(s): 982538d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -15
app.py CHANGED
@@ -131,19 +131,27 @@ h1 {
131
  background-color: #45a049;
132
  }
133
 
134
- .gr-upload-btn {
135
- background-color: #4CAF50;
136
- color: white;
137
- border-radius: 50%;
138
- width: 50px;
139
- height: 50px;
140
- font-size: 24px;
141
  display: flex;
142
  align-items: center;
143
- justify-content: center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  cursor: pointer;
145
- border: none;
146
- margin-top: 10px;
147
  }
148
 
149
  #loading-spinner {
@@ -167,20 +175,22 @@ h1 {
167
  with gr.Column(scale=1):
168
  chatbot_ui = gr.Chatbot(value=[], label="Chat History")
169
  with gr.Column(scale=2):
170
- # Create the "+" button for uploading
171
- upload_button = gr.Button("+", elem_id="upload_btn", visible=True, interactive=True)
 
 
 
172
  upload_section = gr.File(label="Upload NPY Image", type="filepath", visible=False)
173
  upload_status = gr.Textbox(label="Status", interactive=False)
174
  preview_img = gr.Image(label="Image Preview", interactive=False)
175
- message_input = gr.Textbox(placeholder="Type your question here...", label="Your Message")
176
  send_button = gr.Button("Send")
177
  export_button = gr.Button("Export Chat History")
178
  loading_spinner = gr.HTML('<div id="loading-spinner"><img src="https://i.imgur.com/llf5Jjs.gif" alt="Loading..."></div>')
179
 
180
- # Handle file upload when "+" button is clicked
181
  upload_button.click(lambda: upload_section.update(visible=True), None, upload_section)
182
 
183
- # Display loading spinner when uploading an image
184
  upload_section.upload(lambda *args: loading_spinner.update("<div id='loading-spinner'><img src='https://i.imgur.com/llf5Jjs.gif' alt='Loading...'></div>"), upload_section, None)
185
  upload_section.upload(upload_image, upload_section, [upload_status, preview_img])
186
 
 
131
  background-color: #45a049;
132
  }
133
 
134
+ #message-box {
 
 
 
 
 
 
135
  display: flex;
136
  align-items: center;
137
+ position: relative;
138
+ }
139
+
140
+ #message-input {
141
+ width: 100%;
142
+ padding: 10px;
143
+ border-radius: 6px;
144
+ border: 1px solid #ddd;
145
+ font-size: 14px;
146
+ margin-right: 40px; /* To give space for the icon */
147
+ }
148
+
149
+ #upload-icon {
150
+ position: absolute;
151
+ right: 10px;
152
  cursor: pointer;
153
+ font-size: 24px;
154
+ color: #4CAF50;
155
  }
156
 
157
  #loading-spinner {
 
175
  with gr.Column(scale=1):
176
  chatbot_ui = gr.Chatbot(value=[], label="Chat History")
177
  with gr.Column(scale=2):
178
+ # Message input area with the '+' icon inside it
179
+ with gr.Box(elem_id="message-box"):
180
+ message_input = gr.Textbox(placeholder="Type your question here...", label="Your Message", elem_id="message-input")
181
+ upload_button = gr.HTML('<span id="upload-icon">+</span>') # The + icon inside the message box
182
+
183
  upload_section = gr.File(label="Upload NPY Image", type="filepath", visible=False)
184
  upload_status = gr.Textbox(label="Status", interactive=False)
185
  preview_img = gr.Image(label="Image Preview", interactive=False)
 
186
  send_button = gr.Button("Send")
187
  export_button = gr.Button("Export Chat History")
188
  loading_spinner = gr.HTML('<div id="loading-spinner"><img src="https://i.imgur.com/llf5Jjs.gif" alt="Loading..."></div>')
189
 
190
+ # Handle click event for the '+' icon
191
  upload_button.click(lambda: upload_section.update(visible=True), None, upload_section)
192
 
193
+ # Handle file upload
194
  upload_section.upload(lambda *args: loading_spinner.update("<div id='loading-spinner'><img src='https://i.imgur.com/llf5Jjs.gif' alt='Loading...'></div>"), upload_section, None)
195
  upload_section.upload(upload_image, upload_section, [upload_status, preview_img])
196