Pamudu13 commited on
Commit
8d75c5a
·
verified ·
1 Parent(s): df0e1d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +269 -125
app.py CHANGED
@@ -440,164 +440,308 @@ def process_text_with_members(text, selected_members):
440
  return f"Error processing text with members: {str(e)}"
441
 
442
  # Create Gradio interface
 
 
 
 
 
 
 
443
  with gr.Blocks(
444
  title="TaskWhisper",
 
445
  css="""
446
- #component-0 {
447
- max-width: 900px;
448
- margin: auto;
449
- padding: 20px;
450
- background-color: #f5f9f9;
451
- }
452
  .gradio-container {
453
- font-family: 'Inter', -apple-system, sans-serif;
 
 
454
  }
455
- .tabs.svelte-710i53 {
456
- background-color: #e0f2f1;
457
- border-radius: 10px;
458
- padding: 10px;
459
- margin-bottom: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
460
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  .tab-nav {
462
- background-color: #b2dfdb;
463
- border-radius: 8px;
 
 
464
  }
465
- .selected {
466
- background-color: #4db6ac !important;
467
- color: white !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
468
  }
469
- button.primary {
470
- background-color: #26a69a !important;
 
 
471
  color: white !important;
472
- border: none !important;
473
  border-radius: 8px !important;
 
 
 
 
 
 
 
 
 
 
474
  }
475
- button.primary:hover {
476
- background-color: #00897b !important;
 
 
 
 
 
 
477
  }
 
 
478
  .output-markdown {
479
- background-color: white;
480
- padding: 20px;
481
- border-radius: 10px;
482
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
 
 
483
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  .footer {
 
 
 
485
  text-align: center;
486
- color: #666;
487
- font-size: 0.8em;
488
- margin-top: 40px;
489
  }
490
- .input-container {
491
- background-color: white;
492
- padding: 20px;
493
- border-radius: 10px;
494
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
495
- margin-bottom: 20px;
496
- }
497
- .dropdown {
498
- background-color: white;
499
- border: 1px solid #b2dfdb !important;
500
- border-radius: 8px !important;
501
  }
502
- .textbox {
503
- border: 1px solid #b2dfdb !important;
504
- border-radius: 8px !important;
 
 
 
 
 
505
  }
506
  """
507
  ) as interface:
508
- gr.Markdown(
509
- """
510
- <div style='text-align: center; margin-bottom: 30px'>
511
- <h1 style='color: #00897b; margin-bottom: 10px'>🎙️ TaskWhisper</h1>
512
- <p style='color: #666; font-size: 1.1em'>Transform your voice or text into structured tasks</p>
513
- </div>
514
- """
515
- )
516
-
517
- # Get Trello members for the dropdown
518
- members = get_trello_members()
519
-
520
- with gr.Tab("Voice Input"):
521
- with gr.Column(elem_classes="input-container"):
522
- audio_input = gr.Audio(
523
- label="Record or Upload Audio",
524
- sources=["microphone", "upload"],
525
- type="filepath",
526
- format="wav",
527
- interactive=True
528
- )
529
  gr.Markdown(
530
  """
531
- <div style='color: #666; font-size: 0.9em; margin: 10px 0'>
532
- <p><strong>Tips for best results:</strong></p>
533
- <ul>
534
- <li>Speak clearly and at a normal pace</li>
535
- <li>Use a quiet environment</li>
536
- <li>Include key details like deadlines or priority</li>
537
- </ul>
538
  </div>
539
  """
540
  )
541
- member_dropdown_audio = gr.Dropdown(
542
- choices=list(members.keys()),
543
- multiselect=True,
544
- label="Assign Task To",
545
- info="Select team members",
546
- value=[],
547
- elem_classes="dropdown"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
548
  )
549
- audio_button = gr.Button("Create Task", elem_classes="primary")
550
-
551
- with gr.Tab("Text Input"):
552
- with gr.Column(elem_classes="input-container"):
553
- text_input = gr.Textbox(
554
- lines=3,
555
- placeholder="Describe your task here (e.g., 'Need to prepare quarterly report with sales data by next Friday')",
556
- label="Task Description",
557
- elem_classes="textbox"
558
  )
559
- member_dropdown_text = gr.Dropdown(
560
- choices=list(members.keys()),
561
- multiselect=True,
562
- label="Assign Task To",
563
- info="Select team members",
564
- value=[],
565
- elem_classes="dropdown"
566
  )
567
- text_button = gr.Button("Create Task", elem_classes="primary")
568
-
569
- with gr.Column(elem_classes="output-markdown"):
570
- output = gr.Markdown(
571
- label="Task Details",
572
- value="Task details will appear here..."
573
- )
574
-
575
- # Set up event handlers
576
- audio_button.click(
577
- fn=process_audio_with_members,
578
- inputs=[audio_input, member_dropdown_audio],
579
- outputs=output
580
- )
581
-
582
- text_button.click(
583
- fn=process_text_with_members,
584
- inputs=[text_input, member_dropdown_text],
585
- outputs=output
586
- )
587
-
588
- gr.Markdown(
589
- """
590
- <div class='footer'>
591
- <p>TaskWhisper © 2024 | Powered by AI</p>
592
- </div>
593
- """
594
- )
595
 
596
  if __name__ == "__main__":
597
  interface.launch(
598
  show_api=False, # Hide API docs
599
  share=True,
600
- favicon_path="🎙️", # Custom favicon
601
- # Remove Gradio branding
602
- analytics_enabled=False
603
  )
 
440
  return f"Error processing text with members: {str(e)}"
441
 
442
  # Create Gradio interface
443
+ custom_theme = gr.themes.Soft(
444
+ primary_hue="gray",
445
+ secondary_hue="gray",
446
+ neutral_hue="gray",
447
+ text_size=gr.themes.sizes.text_md,
448
+ )
449
+
450
  with gr.Blocks(
451
  title="TaskWhisper",
452
+ theme=custom_theme,
453
  css="""
454
+ /* Reset Gradio defaults */
 
 
 
 
 
455
  .gradio-container {
456
+ margin: 0 !important;
457
+ padding: 0 !important;
458
+ max-width: none !important;
459
  }
460
+
461
+ /* Remove Gradio footer */
462
+ footer {
463
+ display: none !important;
464
+ }
465
+
466
+ /* Custom container */
467
+ #custom-container {
468
+ min-height: 100vh;
469
+ background: #ffffff;
470
+ padding: 2rem;
471
+ }
472
+
473
+ /* Main content wrapper */
474
+ .main-content {
475
+ max-width: 1200px;
476
+ margin: 0 auto;
477
+ background: #ffffff;
478
+ border-radius: 20px;
479
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
480
+ padding: 2rem;
481
+ }
482
+
483
+ /* Header styling */
484
+ .header {
485
+ text-align: center;
486
+ padding: 2rem 0;
487
+ border-bottom: 1px solid #eee;
488
+ margin-bottom: 2rem;
489
  }
490
+
491
+ .header h1 {
492
+ color: #000000;
493
+ font-size: 2.5rem;
494
+ margin-bottom: 0.5rem;
495
+ font-weight: 600;
496
+ }
497
+
498
+ .header p {
499
+ color: #000000;
500
+ font-size: 1.1rem;
501
+ }
502
+
503
+ /* Tab styling */
504
+ .tabs {
505
+ background: none !important;
506
+ border: none !important;
507
+ }
508
+
509
  .tab-nav {
510
+ background: none !important;
511
+ border-bottom: 1px solid #eee !important;
512
+ padding: 0 !important;
513
+ margin-bottom: 2rem !important;
514
  }
515
+
516
+ .tab-nav button {
517
+ padding: 1rem 2rem !important;
518
+ margin-right: 1rem !important;
519
+ border-radius: 8px 8px 0 0 !important;
520
+ border: none !important;
521
+ background: #f8f8f8 !important;
522
+ color: #000000 !important;
523
+ font-weight: 500 !important;
524
+ }
525
+
526
+ .tab-nav button.selected {
527
+ background: #e8e8e8 !important;
528
+ color: #000000 !important;
529
+ font-weight: 600 !important;
530
+ }
531
+
532
+ /* Input container styling */
533
+ .input-container {
534
+ background: #fafafa;
535
+ border-radius: 12px;
536
+ padding: 2rem;
537
+ margin-bottom: 2rem;
538
+ border: 1px solid #eee;
539
+ }
540
+
541
+ /* Form elements */
542
+ .input-container label {
543
+ color: #000000;
544
+ font-weight: 500;
545
+ margin-bottom: 0.5rem;
546
+ }
547
+
548
+ .textbox textarea {
549
+ border: 1px solid #eee !important;
550
+ border-radius: 8px !important;
551
+ padding: 1rem !important;
552
+ font-size: 1rem !important;
553
+ color: #000000 !important;
554
+ background: #ffffff !important;
555
+ }
556
+
557
+ .textbox textarea:focus {
558
+ border-color: #000000 !important;
559
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) !important;
560
+ }
561
+
562
+ .dropdown select {
563
+ border: 1px solid #eee !important;
564
+ border-radius: 8px !important;
565
+ padding: 0.8rem !important;
566
+ color: #000000 !important;
567
+ background: #ffffff !important;
568
  }
569
+
570
+ /* Button styling */
571
+ .primary {
572
+ background: #000000 !important;
573
  color: white !important;
574
+ padding: 0.8rem 1.5rem !important;
575
  border-radius: 8px !important;
576
+ font-weight: 500 !important;
577
+ font-size: 1rem !important;
578
+ border: none !important;
579
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
580
+ transition: all 0.2s ease !important;
581
+ }
582
+
583
+ .primary:hover {
584
+ background: #333333 !important;
585
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
586
  }
587
+
588
+ /* Audio component */
589
+ .audio-component {
590
+ background: #ffffff;
591
+ border: 1px solid #eee;
592
+ border-radius: 12px;
593
+ padding: 1.5rem;
594
+ margin-bottom: 1.5rem;
595
  }
596
+
597
+ /* Output styling */
598
  .output-markdown {
599
+ background: #ffffff;
600
+ border-radius: 12px;
601
+ padding: 2rem;
602
+ margin-top: 2rem;
603
+ border: 1px solid #eee;
604
+ color: #000000;
605
  }
606
+
607
+ /* Custom scrollbar */
608
+ ::-webkit-scrollbar {
609
+ width: 6px;
610
+ }
611
+
612
+ ::-webkit-scrollbar-track {
613
+ background: #f8f8f8;
614
+ }
615
+
616
+ ::-webkit-scrollbar-thumb {
617
+ background: #000000;
618
+ border-radius: 3px;
619
+ }
620
+
621
+ /* Remove Gradio branding */
622
+ .gr-interface {
623
+ background: none !important;
624
+ border: none !important;
625
+ box-shadow: none !important;
626
+ }
627
+
628
  .footer {
629
+ border-top: 1px solid #eee;
630
+ margin-top: 3rem;
631
+ padding-top: 1.5rem;
632
  text-align: center;
633
+ color: #000000;
 
 
634
  }
635
+
636
+ /* Tips section */
637
+ .tips-section {
638
+ color: #000000 !important;
639
+ font-size: 0.9rem !important;
 
 
 
 
 
 
640
  }
641
+
642
+ .tips-section ul {
643
+ margin-left: 1.2rem;
644
+ }
645
+
646
+ /* Make all text black */
647
+ * {
648
+ color: #000000;
649
  }
650
  """
651
  ) as interface:
652
+ with gr.Column(elem_id="custom-container"):
653
+ with gr.Column(elem_classes="main-content"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
654
  gr.Markdown(
655
  """
656
+ <div class='header'>
657
+ <h1>🎙️ TaskWhisper</h1>
658
+ <p>Transform your voice or text into structured tasks</p>
 
 
 
 
659
  </div>
660
  """
661
  )
662
+
663
+ # Get Trello members for the dropdown
664
+ members = get_trello_members()
665
+
666
+ with gr.Tab("Voice Input"):
667
+ with gr.Column(elem_classes="input-container"):
668
+ audio_input = gr.Audio(
669
+ label="Record or Upload Audio",
670
+ sources=["microphone", "upload"],
671
+ type="filepath",
672
+ format="wav",
673
+ interactive=True
674
+ )
675
+ gr.Markdown(
676
+ """
677
+ <div class='tips-section'>
678
+ <p><strong>Tips for best results:</strong></p>
679
+ <ul>
680
+ <li>Speak clearly and at a normal pace</li>
681
+ <li>Use a quiet environment</li>
682
+ <li>Include key details like deadlines or priority</li>
683
+ </ul>
684
+ </div>
685
+ """
686
+ )
687
+ member_dropdown_audio = gr.Dropdown(
688
+ choices=list(members.keys()),
689
+ multiselect=True,
690
+ label="Assign Task To",
691
+ info="Select team members",
692
+ value=[],
693
+ elem_classes="dropdown"
694
+ )
695
+ audio_button = gr.Button("Create Task", elem_classes="primary")
696
+
697
+ with gr.Tab("Text Input"):
698
+ with gr.Column(elem_classes="input-container"):
699
+ text_input = gr.Textbox(
700
+ lines=3,
701
+ placeholder="Describe your task here (e.g., 'Need to prepare quarterly report with sales data by next Friday')",
702
+ label="Task Description",
703
+ elem_classes="textbox"
704
+ )
705
+ member_dropdown_text = gr.Dropdown(
706
+ choices=list(members.keys()),
707
+ multiselect=True,
708
+ label="Assign Task To",
709
+ info="Select team members",
710
+ value=[],
711
+ elem_classes="dropdown"
712
+ )
713
+ text_button = gr.Button("Create Task", elem_classes="primary")
714
+
715
+ with gr.Column(elem_classes="output-markdown"):
716
+ output = gr.Markdown(
717
+ label="Task Details",
718
+ value="Task details will appear here..."
719
+ )
720
+
721
+ # Set up event handlers
722
+ audio_button.click(
723
+ fn=process_audio_with_members,
724
+ inputs=[audio_input, member_dropdown_audio],
725
+ outputs=output
726
  )
727
+
728
+ text_button.click(
729
+ fn=process_text_with_members,
730
+ inputs=[text_input, member_dropdown_text],
731
+ outputs=output
 
 
 
 
732
  )
733
+
734
+ gr.Markdown(
735
+ """
736
+ <div class='footer'>
737
+ <p>TaskWhisper © 2024 | Powered by AI</p>
738
+ </div>
739
+ """
740
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
741
 
742
  if __name__ == "__main__":
743
  interface.launch(
744
  show_api=False, # Hide API docs
745
  share=True,
746
+ favicon_path="🎙️" # Custom favicon
 
 
747
  )