ghuman7 commited on
Commit
065d642
·
verified ·
1 Parent(s): efb4f85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,10 +1,11 @@
1
  import streamlit as st
2
  import requests
3
  import json
 
4
 
5
- # Define API details
6
  API_URL = "https://api-inference.huggingface.co/models/ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
7
- headers = {"Authorization": "Bearer hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
8
 
9
  # Function to query the Hugging Face API
10
  def query_api(audio_file):
 
1
  import streamlit as st
2
  import requests
3
  import json
4
+ import os
5
 
6
+ # Get the API token from environment variables or secrets
7
  API_URL = "https://api-inference.huggingface.co/models/ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
8
+ headers = {"Authorization": f"Bearer {os.getenv('HF_API_TOKEN')}"}
9
 
10
  # Function to query the Hugging Face API
11
  def query_api(audio_file):