Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,11 +4,8 @@ from typing import Generator
|
|
4 |
from fastapi import FastAPI, HTTPException
|
5 |
from fastapi.responses import StreamingResponse
|
6 |
import uvicorn
|
7 |
-
from dotenv import load_dotenv
|
8 |
import os
|
9 |
|
10 |
-
load_dotenv()
|
11 |
-
|
12 |
app = FastAPI()
|
13 |
|
14 |
class v1:
|
@@ -37,7 +34,7 @@ class v1:
|
|
37 |
raise ValueError(f"Model '{model}' is not supported. Choose from {self.AVAILABLE_MODELS}.")
|
38 |
|
39 |
self.session = requests.Session()
|
40 |
-
self.api_endpoint =
|
41 |
self.timeout = timeout
|
42 |
self.model = model
|
43 |
self.device_token = self.get_device_token()
|
@@ -51,7 +48,7 @@ class v1:
|
|
51 |
self.session.proxies = proxies
|
52 |
|
53 |
def get_device_token(self) -> str:
|
54 |
-
device_token_url =
|
55 |
headers = {"Content-Type": "application/json; charset=utf-8"}
|
56 |
data = {}
|
57 |
response = requests.post(
|
|
|
4 |
from fastapi import FastAPI, HTTPException
|
5 |
from fastapi.responses import StreamingResponse
|
6 |
import uvicorn
|
|
|
7 |
import os
|
8 |
|
|
|
|
|
9 |
app = FastAPI()
|
10 |
|
11 |
class v1:
|
|
|
34 |
raise ValueError(f"Model '{model}' is not supported. Choose from {self.AVAILABLE_MODELS}.")
|
35 |
|
36 |
self.session = requests.Session()
|
37 |
+
self.api_endpoint = API_ENDPOINT
|
38 |
self.timeout = timeout
|
39 |
self.model = model
|
40 |
self.device_token = self.get_device_token()
|
|
|
48 |
self.session.proxies = proxies
|
49 |
|
50 |
def get_device_token(self) -> str:
|
51 |
+
device_token_url = DEVICE_TOKEN_URL
|
52 |
headers = {"Content-Type": "application/json; charset=utf-8"}
|
53 |
data = {}
|
54 |
response = requests.post(
|