Spaces:
unijoh
/
Runtime error

unijoh commited on
Commit
9aff6df
1 Parent(s): 01236f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -8
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  import librosa
3
- from asr import transcribe, ASR_EXAMPLES, ASR_NOTE
4
- from tts import synthesize, TTS_EXAMPLES
5
  from lid import identify, LID_EXAMPLES
6
 
7
  demo = gr.Blocks()
@@ -16,18 +16,21 @@ mms_upload_source_trans = gr.Audio(
16
  source="upload", type="filepath", label="Legg ljóðfílu upp", visible=False
17
  )
18
 
19
- # Assuming transcribe is correctly configured to use Faroese language internally
20
- def transcribe_faroese(audio):
21
- # Modify this function based on how you set the language within transcribe
22
- # This example assumes transcribe is globally configured to Faroese
23
- return transcribe(audio)
 
 
24
 
25
  mms_transcribe = gr.Interface(
26
- fn=transcribe_faroese,
27
  inputs=[
28
  mms_select_source_trans,
29
  mms_mic_source_trans,
30
  mms_upload_source_trans,
 
31
  ],
32
  outputs="text",
33
  examples=ASR_EXAMPLES,
@@ -39,10 +42,19 @@ mms_transcribe = gr.Interface(
39
  allow_flagging="never",
40
  )
41
 
 
 
 
 
 
 
 
 
42
  mms_synthesize = gr.Interface(
43
  fn=synthesize,
44
  inputs=[
45
  gr.Text(label="Tekstur at lesa upp"),
 
46
  gr.Slider(minimum=0.1, maximum=4.0, value=1.0, step=0.1, label="Ferð"),
47
  ],
48
  outputs=[
 
1
  import gradio as gr
2
  import librosa
3
+ from asr import transcribe, ASR_EXAMPLES, ASR_LANGUAGES, ASR_NOTE
4
+ from tts import synthesize, TTS_EXAMPLES, TTS_LANGUAGES
5
  from lid import identify, LID_EXAMPLES
6
 
7
  demo = gr.Blocks()
 
16
  source="upload", type="filepath", label="Legg ljóðfílu upp", visible=False
17
  )
18
 
19
+ # Add back the language selection dropdown but set it to be hidden and default to Faroese
20
+ asr_language_dropdown = gr.Dropdown(
21
+ [f"{k} ({v})" for k, v in ASR_LANGUAGES.items()],
22
+ label="Mál",
23
+ value="fao (Faroese)",
24
+ visible=False,
25
+ )
26
 
27
  mms_transcribe = gr.Interface(
28
+ fn=transcribe,
29
  inputs=[
30
  mms_select_source_trans,
31
  mms_mic_source_trans,
32
  mms_upload_source_trans,
33
+ asr_language_dropdown,
34
  ],
35
  outputs="text",
36
  examples=ASR_EXAMPLES,
 
42
  allow_flagging="never",
43
  )
44
 
45
+ # Add back the language selection dropdown but set it to be hidden and default to Faroese
46
+ tts_language_dropdown = gr.Dropdown(
47
+ [f"{k} ({v})" for k, v in TTS_LANGUAGES.items()],
48
+ label="Mál",
49
+ value="fao (Faroese)",
50
+ visible=False,
51
+ )
52
+
53
  mms_synthesize = gr.Interface(
54
  fn=synthesize,
55
  inputs=[
56
  gr.Text(label="Tekstur at lesa upp"),
57
+ tts_language_dropdown,
58
  gr.Slider(minimum=0.1, maximum=4.0, value=1.0, step=0.1, label="Ferð"),
59
  ],
60
  outputs=[