Spaces:
Runtime error
Runtime error
Commit
•
7969547
1
Parent(s):
38c4b76
Update main.py
Browse files
main.py
CHANGED
@@ -3,6 +3,7 @@ from fastapi.responses import StreamingResponse
|
|
3 |
from fastapi.responses import FileResponse, HTMLResponse
|
4 |
import os
|
5 |
import io
|
|
|
6 |
import google.generativeai as genai
|
7 |
|
8 |
import torch
|
@@ -163,6 +164,15 @@ def refresh_model():
|
|
163 |
print("model refreshed")
|
164 |
|
165 |
app = FastAPI()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
@app.post("/llm_response/")
|
167 |
async def llm_response(chain,id,mode):
|
168 |
id = int(id)
|
|
|
3 |
from fastapi.responses import FileResponse, HTMLResponse
|
4 |
import os
|
5 |
import io
|
6 |
+
from fastapi.middleware.cors import CORSMiddleware
|
7 |
import google.generativeai as genai
|
8 |
|
9 |
import torch
|
|
|
164 |
print("model refreshed")
|
165 |
|
166 |
app = FastAPI()
|
167 |
+
|
168 |
+
app.add_middleware(
|
169 |
+
CORSMiddleware,
|
170 |
+
allow_origins=["*"],
|
171 |
+
allow_credentials=True,
|
172 |
+
allow_methods=["*"],
|
173 |
+
allow_headers=["*"],
|
174 |
+
)
|
175 |
+
|
176 |
@app.post("/llm_response/")
|
177 |
async def llm_response(chain,id,mode):
|
178 |
id = int(id)
|