Yehor Smoliakov commited on
Commit
c35542c
·
1 Parent(s): d6446fc
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import sys
2
  import time
3
 
 
 
4
  import torch
5
  import torchaudio
6
  import torchaudio.transforms as T
@@ -8,7 +10,6 @@ import torchaudio.transforms as T
8
  import gradio as gr
9
 
10
  from transformers import AutoModelForCTC, Wav2Vec2BertProcessor
11
- from transformers import __version__ as transformers_version
12
 
13
  # Config
14
  model_name = "Yehor/w2v-bert-2.0-uk-v2"
@@ -109,10 +110,10 @@ tech_env = f"""
109
  tech_libraries = f"""
110
  #### Libraries
111
 
112
- - torch: {torch.__version__}
113
- - torchaudio: {torchaudio.__version__}
114
- - transformers: {transformers_version}
115
- - gradio: {gr.__version__}
116
  """.strip()
117
 
118
 
@@ -123,7 +124,7 @@ def inference(audio_path, progress=gr.Progress()):
123
  gr.Info("Starting recognition", duration=2)
124
 
125
  progress(0, desc="Recognizing")
126
-
127
  meta = torchaudio.info(audio_path)
128
  duration = meta.num_frames / meta.sample_rate
129
 
@@ -147,7 +148,7 @@ def inference(audio_path, progress=gr.Progress()):
147
  audio_duration = meta.num_frames / meta.sample_rate
148
 
149
  audio_input, sr = torchaudio.load(path)
150
-
151
  if meta.num_channels > 1:
152
  audio_input = torch.mean(audio_input, dim=0, keepdim=True)
153
 
@@ -234,9 +235,8 @@ with demo:
234
  gr.Markdown(description_foot)
235
 
236
  gr.Markdown("### Gradio app uses the following technologies:")
237
- with gr.Row():
238
- gr.Markdown(tech_env)
239
- gr.Markdown(tech_libraries)
240
 
241
  if __name__ == "__main__":
242
  demo.queue()
 
1
  import sys
2
  import time
3
 
4
+ from importlib.metadata import version
5
+
6
  import torch
7
  import torchaudio
8
  import torchaudio.transforms as T
 
10
  import gradio as gr
11
 
12
  from transformers import AutoModelForCTC, Wav2Vec2BertProcessor
 
13
 
14
  # Config
15
  model_name = "Yehor/w2v-bert-2.0-uk-v2"
 
110
  tech_libraries = f"""
111
  #### Libraries
112
 
113
+ - torch: {version('torch')}
114
+ - torchaudio: {version('torchaudio')}
115
+ - transformers: {version('transformers')}
116
+ - gradio: {version('gradio')}
117
  """.strip()
118
 
119
 
 
124
  gr.Info("Starting recognition", duration=2)
125
 
126
  progress(0, desc="Recognizing")
127
+
128
  meta = torchaudio.info(audio_path)
129
  duration = meta.num_frames / meta.sample_rate
130
 
 
148
  audio_duration = meta.num_frames / meta.sample_rate
149
 
150
  audio_input, sr = torchaudio.load(path)
151
+
152
  if meta.num_channels > 1:
153
  audio_input = torch.mean(audio_input, dim=0, keepdim=True)
154
 
 
235
  gr.Markdown(description_foot)
236
 
237
  gr.Markdown("### Gradio app uses the following technologies:")
238
+ gr.Markdown(tech_env)
239
+ gr.Markdown(tech_libraries)
 
240
 
241
  if __name__ == "__main__":
242
  demo.queue()