ANYANTUDRE commited on
Commit
5966f2d
·
1 Parent(s): f9ec5b7

fixed small bugs

Browse files
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  from huggingface_hub import login
3
 
4
  import os
5
- from languages import get_language_names
6
  from goai_helpers import goai_traduction, goai_stt, goai_stt2, goai_tts, goai_tts2, goai_ttt_tts_pipeline, goai_stt_ttt_pipeline
7
 
8
  auth_token = os.getenv('HF_SPACE_TOKEN')
@@ -12,8 +12,8 @@ login(token=auth_token)
12
  # list all files in the ./audios directory for the dropdown
13
  AUDIO_FILES = [f for f in os.listdir('./exples_voix') if os.path.isfile(os.path.join('./exples_voix', f))]
14
  MODELES_TTS = ["ArissBandoss/coqui-tts-moore-V1", "ArissBandoss/mms-tts-mos-V18"]
15
- MODELES_ASR = ["ArissBandoss/whisper-small-mos"]
16
- LANGUAGES = ["Automatic Detection"]
17
 
18
  DESCRIPTION = """<div style="display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;">
19
  <div style="flex: 1; min-width: 250px;">
@@ -25,7 +25,7 @@ DESCRIPTION = """<div style="display: flex; justify-content: space-between; alig
25
  <img src="https://github.com/ANYANTUDRE/Stage-IA-Selever-GO-AI-Corp/blob/main/img/goaicorp-logo2.jpg?raw=true" width="300px" style="max-width: 100%; height: auto;">
26
  </div>
27
  </div>
28
- """
29
 
30
 
31
  demo = gr.Blocks(theme=gr.themes.Soft())
@@ -53,10 +53,7 @@ goai_stt_if = gr.Interface(
53
  inputs=[
54
  gr.Audio(sources=["microphone", "upload"], type="filepath"),
55
  gr.Dropdown(
56
- choices=[
57
- "ArissBandoss/whisper-small-mos",
58
- "openai/whisper-large-v3-turbo",
59
- ],
60
  value="ArissBandoss/whisper-small-mos",
61
  label="Model Name"
62
  ),
@@ -128,7 +125,7 @@ goai_stt_ttt_pipeline_if = gr.Interface(
128
  gr.Dropdown(
129
  label="Modèles d'ASR",
130
  choices=MODELES_ASR,
131
- value="Automatic Detection"
132
  ),
133
  gr.Dropdown(
134
  choices=LANGUAGES,
 
2
  from huggingface_hub import login
3
 
4
  import os
5
+ #from languages import get_language_names
6
  from goai_helpers import goai_traduction, goai_stt, goai_stt2, goai_tts, goai_tts2, goai_ttt_tts_pipeline, goai_stt_ttt_pipeline
7
 
8
  auth_token = os.getenv('HF_SPACE_TOKEN')
 
12
  # list all files in the ./audios directory for the dropdown
13
  AUDIO_FILES = [f for f in os.listdir('./exples_voix') if os.path.isfile(os.path.join('./exples_voix', f))]
14
  MODELES_TTS = ["ArissBandoss/coqui-tts-moore-V1", "ArissBandoss/mms-tts-mos-V18"]
15
+ MODELES_ASR = ["ArissBandoss/whisper-small-mos", "openai/whisper-large-v3-turbo"]
16
+ LANGUAGES = ["Automatic Detection"]
17
 
18
  DESCRIPTION = """<div style="display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;">
19
  <div style="flex: 1; min-width: 250px;">
 
25
  <img src="https://github.com/ANYANTUDRE/Stage-IA-Selever-GO-AI-Corp/blob/main/img/goaicorp-logo2.jpg?raw=true" width="300px" style="max-width: 100%; height: auto;">
26
  </div>
27
  </div>
28
+ """
29
 
30
 
31
  demo = gr.Blocks(theme=gr.themes.Soft())
 
53
  inputs=[
54
  gr.Audio(sources=["microphone", "upload"], type="filepath"),
55
  gr.Dropdown(
56
+ choices=MODELES_ASR,
 
 
 
57
  value="ArissBandoss/whisper-small-mos",
58
  label="Model Name"
59
  ),
 
125
  gr.Dropdown(
126
  label="Modèles d'ASR",
127
  choices=MODELES_ASR,
128
+ value="ArissBandoss/whisper-small-mos",
129
  ),
130
  gr.Dropdown(
131
  choices=LANGUAGES,
goai_helpers/goai_stt_ttt_pipeline.py CHANGED
@@ -9,29 +9,26 @@ from goai_helpers.goai_stt2 import transcribe
9
  auth_token = os.getenv('HF_SPACE_TOKEN')
10
  login(token=auth_token)
11
 
12
- MODEL_ASR = "ArissBandoss/whisper-small-mos"
13
- LANGUAGE = "Automatic Detection"
14
-
15
 
16
  # gradio interface translation and text to speech function
17
  @spaces.GPU(duration=120)
18
  def goai_stt_ttt(
19
- inputs,
 
 
20
  batch_size,
21
  chunk_length_s,
22
- stride_length_s,
23
- model=MODEL_ASR,
24
- language=LANGUAGE,
25
  ):
26
 
27
  # 1. STT: Speech To Text
28
  mos_text = transcribe(
29
- inputs,
 
 
30
  batch_size,
31
  chunk_length_s,
32
- stride_length_s,
33
- model=model,
34
- language=language,
35
  )
36
  yield mos_text, None
37
 
 
9
  auth_token = os.getenv('HF_SPACE_TOKEN')
10
  login(token=auth_token)
11
 
 
 
 
12
 
13
  # gradio interface translation and text to speech function
14
  @spaces.GPU(duration=120)
15
  def goai_stt_ttt(
16
+ inputs,
17
+ model,
18
+ language,
19
  batch_size,
20
  chunk_length_s,
21
+ stride_length_s
 
 
22
  ):
23
 
24
  # 1. STT: Speech To Text
25
  mos_text = transcribe(
26
+ inputs,
27
+ model,
28
+ language,
29
  batch_size,
30
  chunk_length_s,
31
+ stride_length_s
 
 
32
  )
33
  yield mos_text, None
34
 
goai_helpers/goai_ttt_tts_pipeline.py CHANGED
@@ -1,5 +1,4 @@
1
  import os
2
- import torch
3
  import spaces
4
  from huggingface_hub import login
5
 
@@ -33,11 +32,11 @@ def goai_many_tts(
33
  else:
34
  audio_array, sampling_rate = text_to_speech(tts, text, reference_speaker=reference_speaker)
35
 
36
- return text, (sampling_rate, audio_array.numpy())
37
 
38
  elif tts_model == "ArissBandoss/mms-tts-mos-V18":
39
  sample_rate, audio_data = goai_tts(text)
40
- return text, (sample_rate, audio_data)
41
 
42
  else:
43
  print("Erreur de modèle!!! Veuillez vérifier le modèle sélectionné.")
 
1
  import os
 
2
  import spaces
3
  from huggingface_hub import login
4
 
 
32
  else:
33
  audio_array, sampling_rate = text_to_speech(tts, text, reference_speaker=reference_speaker)
34
 
35
+ return sampling_rate, audio_array.numpy()
36
 
37
  elif tts_model == "ArissBandoss/mms-tts-mos-V18":
38
  sample_rate, audio_data = goai_tts(text)
39
+ return sample_rate, audio_data
40
 
41
  else:
42
  print("Erreur de modèle!!! Veuillez vérifier le modèle sélectionné.")