Spaces:
Sleeping
Sleeping
import fix
Browse files- api/web_server.py +13 -0
api/web_server.py
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import dill
|
| 2 |
from fastapi import FastAPI, HTTPException
|
| 3 |
from pydantic import BaseModel
|
| 4 |
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
class Query(BaseModel):
|
| 7 |
prompt: str
|
| 8 |
n: int = 5
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
import inspect
|
| 4 |
import dill
|
| 5 |
from fastapi import FastAPI, HTTPException
|
| 6 |
from pydantic import BaseModel
|
| 7 |
|
| 8 |
|
| 9 |
+
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
|
| 10 |
+
parent_dir = os.path.dirname(current_dir)
|
| 11 |
+
prev_dir = sys.path
|
| 12 |
+
sys.path.insert(0, parent_dir+"/core")
|
| 13 |
+
|
| 14 |
+
import search_engine
|
| 15 |
+
|
| 16 |
+
sys.path = prev_dir
|
| 17 |
+
|
| 18 |
+
|
| 19 |
class Query(BaseModel):
|
| 20 |
prompt: str
|
| 21 |
n: int = 5
|