geqintan commited on
Commit
6c92513
·
1 Parent(s): 07cb9f9
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -28,11 +28,11 @@ except Exception as e:
28
  logger.error(f"Failed to load model: {e}")
29
  raise HTTPException(status_code=500, detail="Model loading failed")
30
 
31
- class EmbeddingRequest(BaseModel):
32
- input: str = Field(..., min_length=1, max_length=1000)
33
 
34
  @app.post("/v1/embeddings")
35
- async def embeddings(request: EmbeddingRequest, authorization: str = Depends(check_authorization)):
36
  # async def embeddings(request: EmbeddingRequest):
37
  # logger.info("Received request for embeddings")
38
  # return '2222222222'
@@ -53,7 +53,7 @@ async def embeddings(request: EmbeddingRequest, authorization: str = Depends(che
53
 
54
  # Calculate embeddings
55
  # embeddings = model.encode(input_text)
56
- embeddings = model.encode([t for t in input_texts], normalize_embeddings=True)
57
 
58
  # Format the embeddings in OpenAI compatible format
59
  data = {
 
28
  logger.error(f"Failed to load model: {e}")
29
  raise HTTPException(status_code=500, detail="Model loading failed")
30
 
31
+ # class EmbeddingRequest(BaseModel):
32
+ # input: str = Field(..., min_length=1, max_length=1000)
33
 
34
  @app.post("/v1/embeddings")
35
+ async def embeddings(request, authorization: str = Depends(check_authorization)):
36
  # async def embeddings(request: EmbeddingRequest):
37
  # logger.info("Received request for embeddings")
38
  # return '2222222222'
 
53
 
54
  # Calculate embeddings
55
  # embeddings = model.encode(input_text)
56
+ embeddings_1 = model.encode(input_texts, normalize_embeddings=True)
57
 
58
  # Format the embeddings in OpenAI compatible format
59
  data = {