Joshua-Abok commited on
Commit
dfdd9e9
β€’
1 Parent(s): 93e74e1

env var for hf_token

Browse files
Files changed (2) hide show
  1. app.py +11 -2
  2. requirements.txt +1 -0
app.py CHANGED
@@ -1,6 +1,15 @@
1
  import os
2
  import gradio as gr
 
 
 
3
 
4
- # ASR_SECRET = os.getenv("ASR_SECRET")
5
 
6
- gr.load("models/Joshua-Abok/finetuning-wav2vec-large-swahili-asr-model_v10").launch()
 
 
 
 
 
 
 
 
1
  import os
2
  import gradio as gr
3
+ from huggingface import HfApi
4
+
5
+ # gr.load("models/username/finetuning-wav2vec-large-swahili-asr-model_v10").launch()
6
 
 
7
 
8
+ # Retrieve the Hugging Face token from the environment variable
9
+ HG_TOKEN = os.getenv("HG")
10
+
11
+ # Fetch the model details using the Hugging Face API
12
+ model_info = HfApi().model_details("Joshua-Abok/finetuning-wav2vec-large-swahili-asr-model_v10", hf_token=HG_TOKEN)
13
+
14
+ # Load the model
15
+ gr.load(model_info).launch()
requirements.txt CHANGED
@@ -1 +1,2 @@
1
  gradio
 
 
1
  gradio
2
+ huggingface