Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -47,4 +47,10 @@ async def predict(request: Request):
|
|
47 |
similarity = util.pytorch_cos_sim(query_embedding, embeddings)
|
48 |
best_idx = torch.argmax(similarity).item()
|
49 |
|
50 |
-
return {"data": [answers[best_idx]]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
similarity = util.pytorch_cos_sim(query_embedding, embeddings)
|
48 |
best_idx = torch.argmax(similarity).item()
|
49 |
|
50 |
+
return {"data": [answers[best_idx]]}
|
51 |
+
|
52 |
+
# Jalankan Gradio opsional di thread terpisah
|
53 |
+
if _name_ == "_main_":
|
54 |
+
import threading
|
55 |
+
threading.Thread(target=launch_gradio).start()
|
56 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|