Spaces:
Running
Running
Yassine
commited on
Commit
·
1ea690b
1
Parent(s):
b028259
Integrate dotenv for environment variable management and update GROQ API key retrieval
Browse files- .env +1 -0
- main.py +3 -1
- requirements.txt +2 -1
.env
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
GROQ_API_KEY = "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"
|
main.py
CHANGED
|
@@ -11,6 +11,8 @@ import hashlib
|
|
| 11 |
import json
|
| 12 |
from typing import Optional
|
| 13 |
import httpx # Add this import for HTTP requests
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Define input model
|
| 16 |
|
|
@@ -107,7 +109,7 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
| 107 |
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
| 108 |
|
| 109 |
# Add Groq API key and URL
|
| 110 |
-
GROQ_API_KEY = "
|
| 111 |
GROQ_API_URL = "https://api.groq.com/openai/v1/audio/transcriptions"
|
| 112 |
|
| 113 |
ner_model = ner_model.to(device)
|
|
|
|
| 11 |
import json
|
| 12 |
from typing import Optional
|
| 13 |
import httpx # Add this import for HTTP requests
|
| 14 |
+
from dotenv import load_dotenv
|
| 15 |
+
load_dotenv()
|
| 16 |
|
| 17 |
# Define input model
|
| 18 |
|
|
|
|
| 109 |
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
| 110 |
|
| 111 |
# Add Groq API key and URL
|
| 112 |
+
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
|
| 113 |
GROQ_API_URL = "https://api.groq.com/openai/v1/audio/transcriptions"
|
| 114 |
|
| 115 |
ner_model = ner_model.to(device)
|
requirements.txt
CHANGED
|
@@ -10,4 +10,5 @@ torchaudio
|
|
| 10 |
datasets[audio]
|
| 11 |
accelerate>=0.26.0
|
| 12 |
python-multipart
|
| 13 |
-
httpx
|
|
|
|
|
|
| 10 |
datasets[audio]
|
| 11 |
accelerate>=0.26.0
|
| 12 |
python-multipart
|
| 13 |
+
httpx
|
| 14 |
+
python-dotenv
|