Jackss commited on
Commit
b4549f3
·
1 Parent(s): f2e9e61
Files changed (1) hide show
  1. main.py +8 -5
main.py CHANGED
@@ -17,11 +17,7 @@ model = AutoModel.from_pretrained('allenai/specter')
17
 
18
  app = FastAPI()
19
 
20
- app.mount("/", StaticFiles(directory="static", html=True), name="static")
21
 
22
- @app.get("/")
23
- def index() -> FileResponse:
24
- return FileResponse(path="/app/static/index.html", media_type="text/html")
25
 
26
  @app.get('/similarity')
27
  def similarity(input):
@@ -33,4 +29,11 @@ def similarity(input):
33
  # take the first token in the batch as the embedding
34
  embeddings = result.last_hidden_state[:, 0, :]
35
  res = cosine_similarity(embeddings, embeddings).tolist()
36
- return {"output": res}
 
 
 
 
 
 
 
 
17
 
18
  app = FastAPI()
19
 
 
20
 
 
 
 
21
 
22
  @app.get('/similarity')
23
  def similarity(input):
 
29
  # take the first token in the batch as the embedding
30
  embeddings = result.last_hidden_state[:, 0, :]
31
  res = cosine_similarity(embeddings, embeddings).tolist()
32
+ return {"output": res}
33
+
34
+
35
+ app.mount("/", StaticFiles(directory="static", html=True), name="static")
36
+
37
+ @app.get("/")
38
+ def index() -> FileResponse:
39
+ return FileResponse(path="/app/static/index.html", media_type="text/html")