Athspi commited on
Commit
1f4b6af
·
verified ·
1 Parent(s): 652ba8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -5,17 +5,17 @@ import numpy as np
5
  from transformers import AutoTokenizer
6
  import onnxruntime
7
  import scipy.io.wavfile
 
8
 
9
- # Specify the Hugging Face repository/model directory.
10
- # This repository (Athspi/Gg) should contain the tokenizer files and the ONNX model file.
11
- model_dir = "Athspi/Gg"
12
 
13
- # Define the ONNX model filename. Adjust the filename if needed.
14
- onnx_model_filename = "mms_tts_eng.onnx"
15
- onnx_model_path = os.path.join(model_dir, onnx_model_filename)
16
 
17
- # Load the tokenizer from the Hugging Face model repository
18
- tokenizer = AutoTokenizer.from_pretrained(model_dir)
19
 
20
  # Initialize the ONNX runtime session for inference.
21
  ort_session = onnxruntime.InferenceSession(
 
5
  from transformers import AutoTokenizer
6
  import onnxruntime
7
  import scipy.io.wavfile
8
+ from huggingface_hub import hf_hub_download
9
 
10
+ # Define the Hugging Face repository/model ID.
11
+ repo_id = "Athspi/Gg"
 
12
 
13
+ # Download the ONNX model file from the repository.
14
+ # This will download "mms_tts_eng.onnx" from: https://huggingface.co/Athspi/Gg/resolve/main/mms_tts_eng.onnx
15
+ onnx_model_path = hf_hub_download(repo_id=repo_id, filename="mms_tts_eng.onnx")
16
 
17
+ # Load the tokenizer from the repository.
18
+ tokenizer = AutoTokenizer.from_pretrained(repo_id)
19
 
20
  # Initialize the ONNX runtime session for inference.
21
  ort_session = onnxruntime.InferenceSession(