Almaatla commited on
Commit
ac9faef
·
verified ·
1 Parent(s): 0baa47d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -14,13 +14,13 @@ templates = Jinja2Templates(directory=".")
14
  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"}
22
 
23
- @app.post("/search")
24
  def search_string(text: str, n: int = 5):
25
  embedding = model.encode([text])
26
  distances, indices = index.search(np.array(embedding), n)
 
14
  def read_root(request: Request):
15
  return templates.TemplateResponse("index.html", {"request": request})
16
 
17
+ @app.get("/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"}
22
 
23
+ @app.get("/search")
24
  def search_string(text: str, n: int = 5):
25
  embedding = model.encode([text])
26
  distances, indices = index.search(np.array(embedding), n)