Pamudu13 commited on
Commit
0babec3
·
verified ·
1 Parent(s): 682fb24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +139 -44
app.py CHANGED
@@ -440,56 +440,137 @@ 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(title="TaskWhisper - Smart Task Manager") as interface:
444
- gr.Markdown("# 🎙️ TaskWhisper - Smart Task Manager")
445
- gr.Markdown("Record audio or type your task. The AI will help improve and structure your task description.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
 
447
  # Get Trello members for the dropdown
448
  members = get_trello_members()
449
 
450
- with gr.Tab("Audio Input"):
451
- audio_input = gr.Audio(
452
- label="Record or Upload Audio",
453
- sources=["microphone", "upload"],
454
- type="filepath",
455
- format="wav",
456
- interactive=True
457
- )
458
- gr.Markdown("""
459
- *Instructions:*
460
- - Use microphone to record directly
461
- - Or upload an audio file (WAV format)
462
- - Speak clearly for better results
463
- - Keep background noise minimal
464
- """)
465
- member_dropdown_audio = gr.Dropdown(
466
- choices=list(members.keys()),
467
- multiselect=True,
468
- label="Assign to Members",
469
- info="Select one or more members to assign the task",
470
- value=[]
471
- )
472
- audio_button = gr.Button("Process Audio")
 
 
 
 
 
 
 
473
 
474
  with gr.Tab("Text Input"):
475
- text_input = gr.Textbox(
476
- lines=3,
477
- placeholder="Type your task here (e.g., 'Need to prepare quarterly report with sales data by next Friday')",
478
- label="Text Input"
479
- )
480
- member_dropdown_text = gr.Dropdown(
481
- choices=list(members.keys()),
482
- multiselect=True,
483
- label="Assign to Members",
484
- info="Select one or more members to assign the task",
485
- value=[] # Initialize with empty selection
486
- )
487
- text_button = gr.Button("Process Text")
 
 
 
488
 
489
- output = gr.Textbox(
490
- label="Task Details",
491
- lines=15
492
- )
 
493
 
494
  # Set up event handlers
495
  audio_button.click(
@@ -503,6 +584,20 @@ with gr.Blocks(title="TaskWhisper - Smart Task Manager") as interface:
503
  inputs=[text_input, member_dropdown_text],
504
  outputs=output
505
  )
 
 
 
 
 
 
 
 
506
 
507
  if __name__ == "__main__":
508
- interface.launch(share=True)
 
 
 
 
 
 
 
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.Box(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.Box(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.Box(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(
 
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
+ )