Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
# Loading the ST Model (Whisper)
|
|
|
|
| 2 |
import torch
|
| 3 |
from transformers import pipeline
|
| 4 |
|
|
@@ -15,10 +16,16 @@ def transcribe(audio):
|
|
| 15 |
from huggingface_hub import HfFolder
|
| 16 |
from openai import OpenAI
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
# Initialize OpenAI client for Hugging Face Inference Endpoint
|
| 19 |
client = OpenAI(
|
| 20 |
base_url="https://f2iozzwigntrzkve.us-east-1.aws.endpoints.huggingface.cloud/v1/",
|
| 21 |
-
api_key=
|
| 22 |
)
|
| 23 |
|
| 24 |
|
|
|
|
| 1 |
# Loading the ST Model (Whisper)
|
| 2 |
+
import os
|
| 3 |
import torch
|
| 4 |
from transformers import pipeline
|
| 5 |
|
|
|
|
| 16 |
from huggingface_hub import HfFolder
|
| 17 |
from openai import OpenAI
|
| 18 |
|
| 19 |
+
api_key = os.getenv("API_KEY")
|
| 20 |
+
if api_key is None:
|
| 21 |
+
raise ValueError("API_KEY is not set in the environment variables.")
|
| 22 |
+
print("API key successfully loaded.")
|
| 23 |
+
|
| 24 |
+
|
| 25 |
# Initialize OpenAI client for Hugging Face Inference Endpoint
|
| 26 |
client = OpenAI(
|
| 27 |
base_url="https://f2iozzwigntrzkve.us-east-1.aws.endpoints.huggingface.cloud/v1/",
|
| 28 |
+
api_key=api_key}"
|
| 29 |
)
|
| 30 |
|
| 31 |
|