Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
import streamlit as st
|
2 |
import requests
|
3 |
import json
|
|
|
4 |
|
5 |
-
#
|
6 |
API_URL = "https://api-inference.huggingface.co/models/ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
|
7 |
-
headers = {"Authorization": "Bearer
|
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):
|