Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
-
from fastapi import FastAPI, Request
|
3 |
-
from fastapi.responses import JSONResponse
|
4 |
-
import datetime
|
5 |
-
import requests
|
6 |
-
import os
|
7 |
-
import json
|
8 |
-
import asyncio
|
9 |
-
|
10 |
from fastapi import FastAPI, Request, HTTPException
|
11 |
from fastapi.responses import JSONResponse
|
12 |
import datetime
|
13 |
import requests
|
14 |
import os
|
15 |
import logging
|
|
|
16 |
|
17 |
# Initialize FastAPI
|
18 |
app = FastAPI()
|
@@ -21,10 +14,13 @@ app = FastAPI()
|
|
21 |
logging.basicConfig(level=logging.INFO)
|
22 |
logger = logging.getLogger(__name__)
|
23 |
|
24 |
-
#
|
25 |
-
|
|
|
|
|
|
|
26 |
headers = {
|
27 |
-
"Authorization": f"Bearer {
|
28 |
"Content-Type": "application/json"
|
29 |
}
|
30 |
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
from fastapi import FastAPI, Request, HTTPException
|
3 |
from fastapi.responses import JSONResponse
|
4 |
import datetime
|
5 |
import requests
|
6 |
import os
|
7 |
import logging
|
8 |
+
import toml
|
9 |
|
10 |
# Initialize FastAPI
|
11 |
app = FastAPI()
|
|
|
14 |
logging.basicConfig(level=logging.INFO)
|
15 |
logger = logging.getLogger(__name__)
|
16 |
|
17 |
+
# Load config
|
18 |
+
with open("config.toml") as f:
|
19 |
+
config = toml.load(f)
|
20 |
+
|
21 |
+
API_URL = config["llm"]["api_url"]
|
22 |
headers = {
|
23 |
+
"Authorization": f"Bearer {config['llm']['api_key']}",
|
24 |
"Content-Type": "application/json"
|
25 |
}
|
26 |
|