Ezhil commited on
Commit
daacc73
·
1 Parent(s): 3d5ce86

third commit

Browse files
Files changed (1) hide show
  1. main.py +5 -5
main.py CHANGED
@@ -1,5 +1,5 @@
1
  from fastapi import FastAPI, HTTPException
2
- from services.sms_service import predict_label, compute_cosine_similarity, compute_embeddings
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️⃣ Text Embedding Endpoint
29
- @app.post("/compute_embeddings")
30
- async def get_embeddings(input_data: EmbeddingInput):
31
  try:
32
- return await compute_embeddings(input_data.message)
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)}")