Almaatla commited on
Commit
e26d32e
·
verified ·
1 Parent(s): 3f61915

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from fastapi import FastAPI, Request
2
  from fastapi.templating import Jinja2Templates
3
  from sentence_transformers import SentenceTransformer
4
  import faiss
@@ -15,7 +15,7 @@ def read_root(request: Request):
15
  return templates.TemplateResponse("index.html", {"request": request})
16
 
17
  @app.post("/embed")
18
- def embed_string(text: str):
19
  embedding = model.encode([text])
20
  index.add(np.array(embedding))
21
  return {"message": "String embedded and added to FAISS database"}
 
1
+ from fastapi import FastAPI, Request, Query
2
  from fastapi.templating import Jinja2Templates
3
  from sentence_transformers import SentenceTransformer
4
  import faiss
 
15
  return templates.TemplateResponse("index.html", {"request": request})
16
 
17
  @app.post("/embed")
18
+ def embed_string(text: str = Query(..., description="Text to embed")):
19
  embedding = model.encode([text])
20
  index.add(np.array(embedding))
21
  return {"message": "String embedded and added to FAISS database"}