Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,18 +4,6 @@ import torch
|
|
| 4 |
import requests
|
| 5 |
import os
|
| 6 |
|
| 7 |
-
def fetch_access_token():
|
| 8 |
-
token_response = requests.post(token_url, timeout=15)
|
| 9 |
-
token_response.raise_for_status()
|
| 10 |
-
token = token_response.json()
|
| 11 |
-
return token["access_token"]
|
| 12 |
-
|
| 13 |
-
client_id = config.client_id
|
| 14 |
-
client_secret = config.client_secret
|
| 15 |
-
token_url = "https://id.twitch.tv/oauth2/token?client_id=" + client_id + "&client_secret=" + client_secret + "&grant_type=client_credentials"
|
| 16 |
-
model_id = "distil-whisper/distil-large-v2"
|
| 17 |
-
|
| 18 |
-
access_token = fetch_access_token()
|
| 19 |
|
| 20 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 21 |
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
|
|
|
| 4 |
import requests
|
| 5 |
import os
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 9 |
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|