jonathanjordan21
commited on
Commit
•
9833ff2
1
Parent(s):
b1a4b26
Update app.py
Browse files
app.py
CHANGED
@@ -35,9 +35,9 @@ def greet_json():
|
|
35 |
@app.post("/predict")
|
36 |
async def predict(inp: InputModel):
|
37 |
|
38 |
-
text_emb = model.encode(inp.
|
39 |
|
40 |
-
summarize = model.encode(inp.
|
41 |
|
42 |
out = (torch.nn.functional.cosine_similarity(text_emb, summarize, dim=-1) + 1)/2
|
43 |
# out = (cos_sim(text_emb, summarize) + 1)/2
|
|
|
35 |
@app.post("/predict")
|
36 |
async def predict(inp: InputModel):
|
37 |
|
38 |
+
text_emb = model.encode(inp.content, convert_to_tensor=True)
|
39 |
|
40 |
+
summarize = model.encode(inp.keyword, convert_to_tensor=True)
|
41 |
|
42 |
out = (torch.nn.functional.cosine_similarity(text_emb, summarize, dim=-1) + 1)/2
|
43 |
# out = (cos_sim(text_emb, summarize) + 1)/2
|