anderbogia commited on
Commit
2854844
·
verified ·
1 Parent(s): 97a5e71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -2,14 +2,14 @@ import os
2
  #os.system("curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y") #Installing Rust manually
3
  #os.system("exec bash")
4
  #os.system("pip install --upgrade pip")
5
- os.system("pip install transformers==4.33")
6
  os.system("pip install tokenizers fairseq")
7
  os.system("pip install numpy==1.24") #NumPy 1.24 or less needed by Numba. Use 1.23, librosa still uses np.complex which was dropped in NumPy 1.24
8
  #os.system("pip install git+https://github.com/huggingface/transformers datasets[torch]")
9
- os.system("pip install torch accelerate torchaudio datasets")
10
  os.system("pip install librosa==0.9.0")
11
 
12
-
13
  import gradio as gr
14
  from transformers import pipeline, Wav2Vec2ForCTC, AutoProcessor, VitsModel, AutoTokenizer
15
  from datasets import load_dataset, Audio, Dataset
@@ -69,8 +69,8 @@ with gr.Blocks(theme = gr.themes.Soft()) as demo:
69
 
70
  with torch.no_grad():
71
  output = model_tts(**tokenized_input).waveform
72
-
73
- gradio_tuple = (16000, output[0])
74
 
75
  return gradio_tuple
76
 
@@ -85,7 +85,7 @@ with gr.Blocks(theme = gr.themes.Soft()) as demo:
85
  """)
86
  with gr.Column(scale = 4):
87
  with gr.Tab("Rolou kumaa ginarit"):
88
- input_audio = gr.Audio(sources = ['microphone'], type = 'filepath', label = "Gakamai rolou nu", format = 'wav')
89
  output_text = gr.components.Textbox(label = "Dalinsuat")
90
  button1 = gr.Button("Dalinsuato' | Transcribe")
91
  button1.click(transcribe, inputs = input_audio, outputs = output_text)
 
2
  #os.system("curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y") #Installing Rust manually
3
  #os.system("exec bash")
4
  #os.system("pip install --upgrade pip")
5
+ os.system("pip install --upgrade transformers accelerate")
6
  os.system("pip install tokenizers fairseq")
7
  os.system("pip install numpy==1.24") #NumPy 1.24 or less needed by Numba. Use 1.23, librosa still uses np.complex which was dropped in NumPy 1.24
8
  #os.system("pip install git+https://github.com/huggingface/transformers datasets[torch]")
9
+ os.system("pip install torch transformers accelerate torchaudio datasets")
10
  os.system("pip install librosa==0.9.0")
11
 
12
+ import scipy
13
  import gradio as gr
14
  from transformers import pipeline, Wav2Vec2ForCTC, AutoProcessor, VitsModel, AutoTokenizer
15
  from datasets import load_dataset, Audio, Dataset
 
69
 
70
  with torch.no_grad():
71
  output = model_tts(**tokenized_input).waveform
72
+
73
+ gradio_tuple = (16000, output[0].detach().cpu().numpy())
74
 
75
  return gradio_tuple
76
 
 
85
  """)
86
  with gr.Column(scale = 4):
87
  with gr.Tab("Rolou kumaa ginarit"):
88
+ input_audio = gr.Audio(sources = ['microphone'], type = 'filepath', label = "Gakamai rolou nu", format = 'mp3')
89
  output_text = gr.components.Textbox(label = "Dalinsuat")
90
  button1 = gr.Button("Dalinsuato' | Transcribe")
91
  button1.click(transcribe, inputs = input_audio, outputs = output_text)