Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -377,221 +377,7 @@ def demo():
|
|
377 |
inputs=None, \
|
378 |
outputs=[chatbot, doc_source1, source1_page, doc_source2, source2_page, doc_source3, source3_page], \
|
379 |
queue=False)
|
380 |
-
|
381 |
|
382 |
if __name__ == "__main__":
|
383 |
-
|
384 |
-
css="""
|
385 |
-
/* General styling */
|
386 |
-
body {
|
387 |
-
font-family: Arial, sans-serif;
|
388 |
-
line-height: 1.6;
|
389 |
-
color: #333;
|
390 |
-
background-color: #f5f5f5;
|
391 |
-
padding: 20px;
|
392 |
-
}
|
393 |
-
|
394 |
-
h2, h3 {
|
395 |
-
line-height: 1.2;
|
396 |
-
}
|
397 |
-
|
398 |
-
h2 {
|
399 |
-
font-size: 2rem;
|
400 |
-
margin-bottom: 10px;
|
401 |
-
}
|
402 |
-
|
403 |
-
h3 {
|
404 |
-
font-size: 1.2rem;
|
405 |
-
margin-top: 20px;
|
406 |
-
}
|
407 |
-
|
408 |
-
a {
|
409 |
-
color: #007bff;
|
410 |
-
text-decoration: none;
|
411 |
-
}
|
412 |
-
|
413 |
-
a:hover {
|
414 |
-
text-decoration: underline;
|
415 |
-
}
|
416 |
-
|
417 |
-
/* Input elements */
|
418 |
-
input[type="file"] {
|
419 |
-
border: 1px solid #ccc;
|
420 |
-
border-radius: 4px;
|
421 |
-
padding: 5px;
|
422 |
-
outline: none;
|
423 |
-
}
|
424 |
-
|
425 |
-
select {
|
426 |
-
appearance: menulist;
|
427 |
-
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 8'><polygon points='0,0 14,0 7,8'/></svg>");
|
428 |
-
background-repeat: no-repeat;
|
429 |
-
background-position: right 10px center;
|
430 |
-
background-size: 12px;
|
431 |
-
border: 1px solid #ccc;
|
432 |
-
border-radius: 4px;
|
433 |
-
padding: 5px;
|
434 |
-
outline: none;
|
435 |
-
cursor: pointer;
|
436 |
-
}
|
437 |
-
|
438 |
-
slider {
|
439 |
-
width: 100%;
|
440 |
-
margin-bottom: 10px;
|
441 |
-
}
|
442 |
-
|
443 |
-
button {
|
444 |
-
background-color: #007bff;
|
445 |
-
color: white;
|
446 |
-
border: none;
|
447 |
-
border-radius: 4px;
|
448 |
-
padding: 10px;
|
449 |
-
cursor: pointer;
|
450 |
-
}
|
451 |
-
|
452 |
-
button:hover {
|
453 |
-
background-color: #0056b3;
|
454 |
-
}
|
455 |
-
|
456 |
-
button:disabled {
|
457 |
-
opacity: 0.5;
|
458 |
-
cursor: not-allowed;
|
459 |
-
}
|
460 |
-
|
461 |
-
/* Chatbot section */
|
462 |
-
.gradio-Chatbox {
|
463 |
-
border: 1px solid #ddd;
|
464 |
-
border-radius: 4px;
|
465 |
-
padding: 10px;
|
466 |
-
margin-top: 20px;
|
467 |
-
}
|
468 |
-
|
469 |
-
.gradio-Chatbox .gradio-ChatMessage--system {
|
470 |
-
background-color: #eee;
|
471 |
-
padding: 10px;
|
472 |
-
border-radius: 4px;
|
473 |
-
margin-bottom: 10px;
|
474 |
-
}
|
475 |
-
|
476 |
-
.gradio-Chatbox .gradio-ChatMessage--assistant {
|
477 |
-
background-color: #f5f5f5;
|
478 |
-
padding: 10px;
|
479 |
-
border-radius: 4px;
|
480 |
-
margin-bottom: 10px;
|
481 |
-
}
|
482 |
-
|
483 |
-
.gradio-Chatbox .gradio-ChatInputContainer {
|
484 |
-
margin-top: 10px;
|
485 |
-
}
|
486 |
-
|
487 |
-
.gradio-Chatbox .gradio-ChatInputContainer input[type="text"] {
|
488 |
-
width: calc(100% - 40px);
|
489 |
-
padding: 10px;
|
490 |
-
border: none;
|
491 |
-
border-radius: 4px;
|
492 |
-
}
|
493 |
-
|
494 |
-
.gradio-Chatbox .gradio-ChatInputContainer button {
|
495 |
-
width: 30px;
|
496 |
-
height: 30px;
|
497 |
-
padding: 0;
|
498 |
-
min-width: auto;
|
499 |
-
border: none;
|
500 |
-
border-radius: 50%;
|
501 |
-
position: relative;
|
502 |
-
overflow: hidden;
|
503 |
-
box-shadow: 0 0 0 1px rgb(0 0 0 / 10%), 0 2px 4px rgb(0 0 0 / 10%);
|
504 |
-
transition: all 0.2s ease-in-out;
|
505 |
-
background-color: #007bff;
|
506 |
-
color: white;
|
507 |
-
}
|
508 |
-
|
509 |
-
.gradio-Chatbox .gradio-ChatInputContainer button::before {
|
510 |
-
content: "";
|
511 |
-
position: absolute;
|
512 |
-
left: -50%;
|
513 |
-
top: -50%;
|
514 |
-
width: 200%;
|
515 |
-
height: 200%;
|
516 |
-
background-color: currentColor;
|
517 |
-
opacity: 0;
|
518 |
-
transition: all 0.2s ease-in-out;
|
519 |
-
transform-origin: center;
|
520 |
-
}
|
521 |
-
|
522 |
-
.gradio-Chatbox .gradio-ChatInputContainer button:focus {
|
523 |
-
box-shadow: 0 0 0 2px rgb(0 0 0 / 20%), 0 2px 4px rgb(0 0 0 / 15%);
|
524 |
-
}
|
525 |
-
|
526 |
-
.gradio-Chatbox .gradio-ChatInputContainer button:active {
|
527 |
-
transform: translateY(1px);
|
528 |
-
}
|
529 |
-
|
530 |
-
.gradio-Chatbox .gradio-ChatInputContainer button:hover:not(:focus):not(:active) {
|
531 |
-
filter: brightness(90%);
|
532 |
-
}
|
533 |
-
|
534 |
-
.gradio-Chatbox .gradio-ChatInputContainer button:hover:not(:focus):not(:active)::before {
|
535 |
-
opacity: 0.2;
|
536 |
-
}
|
537 |
-
|
538 |
-
.gradio-Chatbox .gradio-ChatInputContainer button:active:not(:focus)::before {
|
539 |
-
opacity: 0.5;
|
540 |
-
transform: rotate(-45deg) scaleX(1.5) scaleY(1.3);
|
541 |
-
}
|
542 |
-
|
543 |
-
/* Accordion sections */
|
544 |
-
.accordion-section {
|
545 |
-
margin-top: 20px;
|
546 |
-
}
|
547 |
-
|
548 |
-
/* Progress bars */
|
549 |
-
.progressbar-container {
|
550 |
-
margin-top: 10px;
|
551 |
-
}
|
552 |
-
|
553 |
-
.progressbar-container .progressbar-label {
|
554 |
-
margin-right: 10px;
|
555 |
-
}
|
556 |
-
|
557 |
-
.progressbar-container .progressbar-percentage {
|
558 |
-
float: right;
|
559 |
-
}
|
560 |
-
|
561 |
-
/* Tooltip component */
|
562 |
-
.tooltip-wrapper {
|
563 |
-
position: relative;
|
564 |
-
}
|
565 |
-
|
566 |
-
.tooltip-wrapper .tooltip {
|
567 |
-
visibility: hidden;
|
568 |
-
background-color: #f9f9f9;
|
569 |
-
color: #333;
|
570 |
-
text-align: center;
|
571 |
-
padding: 5px 0;
|
572 |
-
border-radius: 6px;
|
573 |
-
position: absolute;
|
574 |
-
z-index: 1;
|
575 |
-
bottom: 100%;
|
576 |
-
left: 50%;
|
577 |
-
margin-left: -60px;
|
578 |
-
opacity: 0;
|
579 |
-
transition: opacity 0.3s;
|
580 |
-
}
|
581 |
-
|
582 |
-
.tooltip-wrapper .tooltip::after {
|
583 |
-
content: "";
|
584 |
-
position: absolute;
|
585 |
-
top: 100%;
|
586 |
-
left: 50%;
|
587 |
-
margin-left: -5px;
|
588 |
-
border-width: 5px;
|
589 |
-
border-style: solid;
|
590 |
-
border-color: #f9f9f9 transparent transparent transparent;
|
591 |
-
}
|
592 |
-
|
593 |
-
.tooltip-wrapper:hover .tooltip {
|
594 |
-
visibility: visible;
|
595 |
-
opacity: 1;
|
596 |
-
}
|
597 |
-
""").launch(debug=True)
|
|
|
377 |
inputs=None, \
|
378 |
outputs=[chatbot, doc_source1, source1_page, doc_source2, source2_page, doc_source3, source3_page], \
|
379 |
queue=False)
|
380 |
+
demo.queue().launch(debug=True)
|
381 |
|
382 |
if __name__ == "__main__":
|
383 |
+
demo()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|