Artem0729 commited on
Commit
db2271c
·
verified ·
1 Parent(s): 362486b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -305,7 +305,6 @@ js_code = """
305
  font-size: 20px;
306
  padding-top: 13px;
307
  }
308
-
309
  textarea {
310
  height: 90px !important;
311
  padding: 20px !important;
@@ -343,7 +342,7 @@ js_code = """
343
  }
344
 
345
  #custom-btn {
346
- padding: 6px;
347
  width: 90px;
348
  height: 90px;
349
  cursor: pointer;
@@ -369,7 +368,6 @@ js_code = """
369
  0px 4px 4px 0px rgba(0,0,0,0.16),
370
  0px 8px 8px 0px rgba(0,0,0,0.2);
371
  }
372
-
373
  #component-4 {
374
  background-color: #006666;
375
  height: 70px;
@@ -406,16 +404,15 @@ js_code = """
406
  if (chatbox.style.transform === 'scaleY(0)') {
407
  chatbox.style.transform = 'scaleY(1)';
408
  chatbox.style.opacity = '1';
409
- buttonImg.src = "/file=mess.png";
410
  messageBtn.style.transform = 'rotate(360deg)';
411
  } else {
412
  chatbox.style.transform = 'scaleY(0)';
413
  chatbox.style.opacity = '0';
414
- buttonImg.src = "/file=message.png";
415
  messageBtn.style.transform = 'rotate(0deg)';
416
  }
417
  }
418
-
419
 
420
  function autoScroll() {
421
  const chatbox = document.querySelector('.bubble-wrap');
@@ -423,19 +420,16 @@ js_code = """
423
  chatbox.scrollTop = chatbox.scrollHeight;
424
  }
425
  }
426
-
427
  setInterval(() => {
428
  const messageBtn = document.getElementById('message-btn');
429
  if (messageBtn) {
430
  messageBtn.addEventListener('click', toggleChatbox);
431
  }
432
-
433
  const userInputBox = document.querySelector('textarea.scroll-hide');
434
  if (userInputBox) {
435
  userInputBox.addEventListener('keypress', autoScroll, false);
436
  }
437
  }, 1000);
438
-
439
  </script>
440
  """
441
 
@@ -451,7 +445,7 @@ with gr.Blocks(head=js_code) as demo:
451
  chatbox = gr.ChatInterface(fn=search, title="Mediate.com Chatbot Application", multimodal=False, retry_btn=None, clear_btn=None, undo_btn=None, chatbot=chatbot)
452
 
453
 
454
- gr.HTML(f'<button src="/file=message.png" id="message-btn"/><img style="display: inline;" src="/file=message.png" id="custom-btn"/><button>')
455
 
456
  if __name__ == "__main__":
457
  demo.launch(debug=True, allowed_paths=["./"])
 
305
  font-size: 20px;
306
  padding-top: 13px;
307
  }
 
308
  textarea {
309
  height: 90px !important;
310
  padding: 20px !important;
 
342
  }
343
 
344
  #custom-btn {
345
+ padding: 15px;
346
  width: 90px;
347
  height: 90px;
348
  cursor: pointer;
 
368
  0px 4px 4px 0px rgba(0,0,0,0.16),
369
  0px 8px 8px 0px rgba(0,0,0,0.2);
370
  }
 
371
  #component-4 {
372
  background-color: #006666;
373
  height: 70px;
 
404
  if (chatbox.style.transform === 'scaleY(0)') {
405
  chatbox.style.transform = 'scaleY(1)';
406
  chatbox.style.opacity = '1';
407
+ buttonImg.src = "/file=close.png";
408
  messageBtn.style.transform = 'rotate(360deg)';
409
  } else {
410
  chatbox.style.transform = 'scaleY(0)';
411
  chatbox.style.opacity = '0';
412
+ buttonImg.src = "/file=chat.png";
413
  messageBtn.style.transform = 'rotate(0deg)';
414
  }
415
  }
 
416
 
417
  function autoScroll() {
418
  const chatbox = document.querySelector('.bubble-wrap');
 
420
  chatbox.scrollTop = chatbox.scrollHeight;
421
  }
422
  }
 
423
  setInterval(() => {
424
  const messageBtn = document.getElementById('message-btn');
425
  if (messageBtn) {
426
  messageBtn.addEventListener('click', toggleChatbox);
427
  }
 
428
  const userInputBox = document.querySelector('textarea.scroll-hide');
429
  if (userInputBox) {
430
  userInputBox.addEventListener('keypress', autoScroll, false);
431
  }
432
  }, 1000);
 
433
  </script>
434
  """
435
 
 
445
  chatbox = gr.ChatInterface(fn=search, title="Mediate.com Chatbot Application", multimodal=False, retry_btn=None, clear_btn=None, undo_btn=None, chatbot=chatbot)
446
 
447
 
448
+ gr.HTML(f'<button id="message-btn"/><img style="display: inline;" src="/file=chat.png" id="custom-btn"/><button>')
449
 
450
  if __name__ == "__main__":
451
  demo.launch(debug=True, allowed_paths=["./"])