AlsuGibadullina commited on
Commit
0d4e900
·
verified ·
1 Parent(s): 1f2d518

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -113
app.py CHANGED
@@ -593,121 +593,9 @@ def parse_point_coordinates_text(coordinates_text: str) -> List[List[int]]:
593
  return point_list
594
 
595
  def build_interface():
596
- with gr.Blocks(title="Multimodal AI Demo", theme=gr.themes.Soft()) as demo_block:
597
  gr.Markdown("# AI модели")
598
 
599
- with gr.Tab("Классификация аудио"):
600
- gr.Markdown("## Классификация аудио")
601
- with gr.Row():
602
- audio_input_component = gr.Audio(
603
- label="Загрузите аудиофайл",
604
- type="filepath",
605
- )
606
- audio_model_selector = gr.Dropdown(
607
- choices=["audio_classifier", "emotion_classifier"],
608
- label="Выберите модель",
609
- value="audio_classifier",
610
- info=(
611
- "audio_classifier - общая классификация (курс)"
612
- "emotion_classifier - эмоции в речи "
613
- ),
614
- )
615
- audio_classify_button = gr.Button("Применить")
616
-
617
- audio_output_component = gr.Textbox(
618
- label="Результаты классификации",
619
- lines=10,
620
- )
621
-
622
- audio_classify_button.click(
623
- fn=classify_audio_file,
624
- inputs=[audio_input_component, audio_model_selector],
625
- outputs=audio_output_component,
626
- )
627
-
628
- with gr.Tab("Zero-Shot аудио"):
629
- gr.Markdown("## Zero-Shot аудио классификатор")
630
- with gr.Row():
631
- clap_audio_input_component = gr.Audio(
632
- label="Загрузите аудиофайл",
633
- type="filepath",
634
- )
635
- clap_label_texts_component = gr.Textbox(
636
- label="Кандидатные метки (через запятую)",
637
- placeholder="лай собаки, шум дождя, музыка, разговор",
638
- lines=2,
639
- )
640
- clap_button = gr.Button("Применить")
641
-
642
- clap_output_component = gr.Textbox(
643
- label="Результаты zero-shot классификации",
644
- lines=10,
645
- )
646
-
647
- clap_button.click(
648
- fn=classify_audio_zero_shot_clap,
649
- inputs=[clap_audio_input_component, clap_label_texts_component],
650
- outputs=clap_output_component,
651
- )
652
-
653
- with gr.Tab("Распознавание речи"):
654
- gr.Markdown("## Распознавание реч")
655
- with gr.Row():
656
- asr_audio_input_component = gr.Audio(
657
- label="Загрузите аудио с речью",
658
- type="filepath",
659
- )
660
- asr_model_selector = gr.Dropdown(
661
- choices=["whisper", "wav2vec2"],
662
- label="Выберите модель",
663
- value="whisper",
664
- info=(
665
- "whisper - distil-whisper/distil-small.en (курс),\n"
666
- "wav2vec2 - openai/whisper-small"
667
- ),
668
- )
669
- asr_button = gr.Button("Применить")
670
-
671
- asr_output_component = gr.Textbox(
672
- label="Транскрипция",
673
- lines=5,
674
- )
675
-
676
- asr_button.click(
677
- fn=recognize_speech,
678
- inputs=[asr_audio_input_component, asr_model_selector],
679
- outputs=asr_output_component,
680
- )
681
- with gr.Tab("Синтез речи"):
682
- gr.Markdown("## Text-to-Speech")
683
- with gr.Row():
684
- tts_text_component = gr.Textbox(
685
- label="Введите текст для синтеза",
686
- placeholder="Введите текст на русском или английском языке...",
687
- lines=3,
688
- )
689
- tts_model_selector = gr.Dropdown(
690
- choices=["mms", "Google TTS"],
691
- label="Выберите модель",
692
- value="mms",
693
- info=(
694
- "facebook/mms-tts-rus\n"
695
- "Google TTS"
696
- ),
697
- )
698
- tts_button = gr.Button("Применить")
699
-
700
- tts_audio_output_component = gr.Audio(
701
- label="Синтезированная речь",
702
- type="filepath",
703
- )
704
-
705
- tts_button.click(
706
- fn=synthesize_speech,
707
- inputs=[tts_text_component, tts_model_selector],
708
- outputs=tts_audio_output_component,
709
- )
710
-
711
  with gr.Tab("Детекция объектов"):
712
  gr.Markdown("## Детекция объектов")
713
  with gr.Row():
 
593
  return point_list
594
 
595
  def build_interface():
596
+ with gr.Blocks(title="Multimodal AI Demo") as demo_block:
597
  gr.Markdown("# AI модели")
598
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599
  with gr.Tab("Детекция объектов"):
600
  gr.Markdown("## Детекция объектов")
601
  with gr.Row():