kozak-vaclav commited on
Commit
d3b9c5f
1 Parent(s): 70ac248

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import tensorflow as tf
3
  import librosa
4
  import numpy as np
5
- from huggingface_hub import hf_hub_download
6
 
7
  # Mel Spectrogram parameters
8
  n_fft = 512 # FFT window length
@@ -29,9 +29,10 @@ def CTCLoss(y_true, y_pred):
29
  return loss
30
 
31
  # Download model from Hugging Face Hub
32
- model_path = hf_hub_download(repo_id="kobrasoft/kobraspeech-rnn-cs", filename="saved_model.pb")
33
- with tf.keras.utils.custom_object_scope({'CTCLoss': CTCLoss}):
34
- model = tf.keras.models.load_model(model_path)
 
35
 
36
  import pickle as pkl
37
 
 
2
  import tensorflow as tf
3
  import librosa
4
  import numpy as np
5
+ from huggingface_hub import hf_hub_download, from_pretrained_keras
6
 
7
  # Mel Spectrogram parameters
8
  n_fft = 512 # FFT window length
 
29
  return loss
30
 
31
  # Download model from Hugging Face Hub
32
+ # model_path = hf_hub_download(repo_id="kobrasoft/kobraspeech-rnn-cs", filename="saved_model.pb")
33
+ # with tf.keras.utils.custom_object_scope({'CTCLoss': CTCLoss}):
34
+ # model = tf.keras.models.load_model(model_path)
35
+ model = from_pretrained_keras("kobrasoft/kobraspeech-rnn-cs")
36
 
37
  import pickle as pkl
38