Spaces:
Sleeping
Sleeping
response from root
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from fastapi import FastAPI, Request
|
2 |
from os import getenv
|
3 |
from langchain_huggingface import HuggingFaceEmbeddings
|
4 |
-
from fastapi.responses import HTMLResponse
|
5 |
from fastapi.staticfiles import StaticFiles
|
6 |
|
7 |
app = FastAPI()
|
@@ -9,7 +9,7 @@ MY_KEY = getenv("MY_KEY")
|
|
9 |
|
10 |
embeddings = HuggingFaceEmbeddings(model_name="jinaai/jina-embeddings-v2-small-en")
|
11 |
|
12 |
-
app.mount("/static", StaticFiles(directory="static"), name="static")
|
13 |
|
14 |
@app.post("/receive-embeddings")
|
15 |
async def receive_embeddings(request: Request):
|
@@ -28,6 +28,5 @@ def get_embeddings(input: str):
|
|
28 |
|
29 |
@app.get("/", response_class=HTMLResponse)
|
30 |
def get_index():
|
31 |
-
|
32 |
-
return f.read()
|
33 |
|
|
|
1 |
from fastapi import FastAPI, Request
|
2 |
from os import getenv
|
3 |
from langchain_huggingface import HuggingFaceEmbeddings
|
4 |
+
from fastapi.responses import HTMLResponse, FileResponse
|
5 |
from fastapi.staticfiles import StaticFiles
|
6 |
|
7 |
app = FastAPI()
|
|
|
9 |
|
10 |
embeddings = HuggingFaceEmbeddings(model_name="jinaai/jina-embeddings-v2-small-en")
|
11 |
|
12 |
+
app.mount("/static", StaticFiles(directory="static", html=True), name="static")
|
13 |
|
14 |
@app.post("/receive-embeddings")
|
15 |
async def receive_embeddings(request: Request):
|
|
|
28 |
|
29 |
@app.get("/", response_class=HTMLResponse)
|
30 |
def get_index():
|
31 |
+
return FileResponse(path="/app/static/index.html", media_type="text/html")
|
|
|
32 |
|