ariankhalfani commited on
Commit
1789b0c
·
verified ·
1 Parent(s): 7bd067a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -10,8 +10,8 @@ API_URL_ROBERTA = "https://api-inference.huggingface.co/models/deepset/roberta-b
10
  API_URL_TTS = "https://api-inference.huggingface.co/models/espnet/english_male_ryanspeech_tacotron"
11
  API_URL_WHISPER = "https://api-inference.huggingface.co/models/openai/whisper-large-v2"
12
 
13
- # Hugging Face API Token from environment variable
14
- API_TOKEN = os.getenv("API_KEY")
15
  HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
16
 
17
  # Retry settings
@@ -30,7 +30,7 @@ def query_whisper(audio_path):
30
  with open(audio_path, "rb") as f:
31
  data = f.read()
32
 
33
- response = requests.post(API_URL_WHISPER, headers=HEADERS, data=data)
34
  response.raise_for_status()
35
  return response.json()
36
 
@@ -130,4 +130,4 @@ iface = gr.Interface(
130
  )
131
 
132
  # Launch the Gradio app
133
- iface.launch()
 
10
  API_URL_TTS = "https://api-inference.huggingface.co/models/espnet/english_male_ryanspeech_tacotron"
11
  API_URL_WHISPER = "https://api-inference.huggingface.co/models/openai/whisper-large-v2"
12
 
13
+ # Hugging Face API Token
14
+ API_TOKEN = os.getenv("HF_API_KEY") # Ensure you have set this environment variable
15
  HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
16
 
17
  # Retry settings
 
30
  with open(audio_path, "rb") as f:
31
  data = f.read()
32
 
33
+ response = requests.post(API_URL_WHISPER, headers=HEADERS, files={"file": data})
34
  response.raise_for_status()
35
  return response.json()
36
 
 
130
  )
131
 
132
  # Launch the Gradio app
133
+ iface.launch(share=True)