Spaces:
Runtime error
Runtime error
Ezhil
commited on
Commit
·
daacc73
1
Parent(s):
3d5ce86
third commit
Browse files
main.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from fastapi import FastAPI, HTTPException
|
| 2 |
-
from services.sms_service import predict_label, compute_cosine_similarity,
|
| 3 |
from schemas.input_schemas import CosineSimilarityInput, MessageInput, EmbeddingInput
|
| 4 |
|
| 5 |
app = FastAPI()
|
|
@@ -25,10 +25,10 @@ async def classify_message(input_data: MessageInput):
|
|
| 25 |
except Exception as e:
|
| 26 |
raise HTTPException(status_code=500, detail=f"Error predicting label: {str(e)}")
|
| 27 |
|
| 28 |
-
# 📊 4️⃣
|
| 29 |
-
@app.post("/
|
| 30 |
-
async def
|
| 31 |
try:
|
| 32 |
-
return await
|
| 33 |
except Exception as e:
|
| 34 |
raise HTTPException(status_code=500, detail=f"Error computing embeddings: {str(e)}")
|
|
|
|
| 1 |
from fastapi import FastAPI, HTTPException
|
| 2 |
+
from services.sms_service import predict_label, compute_cosine_similarity, get_embedding_from_transformer
|
| 3 |
from schemas.input_schemas import CosineSimilarityInput, MessageInput, EmbeddingInput
|
| 4 |
|
| 5 |
app = FastAPI()
|
|
|
|
| 25 |
except Exception as e:
|
| 26 |
raise HTTPException(status_code=500, detail=f"Error predicting label: {str(e)}")
|
| 27 |
|
| 28 |
+
# 📊 4️⃣ Get Embedding from Sentence Transformer
|
| 29 |
+
@app.post("/get_embedding")
|
| 30 |
+
async def get_embedding(input_data: EmbeddingInput):
|
| 31 |
try:
|
| 32 |
+
return await get_embedding(input_data.message)
|
| 33 |
except Exception as e:
|
| 34 |
raise HTTPException(status_code=500, detail=f"Error computing embeddings: {str(e)}")
|