Update app.py
Browse files
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(
|
444 |
-
|
445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
|
447 |
# Get Trello members for the dropdown
|
448 |
members = get_trello_members()
|
449 |
|
450 |
-
with gr.Tab("
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
|
474 |
with gr.Tab("Text Input"):
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
|
|
|
|
|
|
488 |
|
489 |
-
|
490 |
-
|
491 |
-
|
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(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
)
|