mateoluksenberg commited on
Commit
34bee7a
1 Parent(s): e1bb0a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -9,12 +9,12 @@ app = FastAPI()
9
  # Load the image classification pipeline
10
  pipe = pipeline("image-classification", model="mateoluksenberg/dit-base-Classifier_CM05")
11
 
12
- class Message(BaseModel):
13
- text: str
14
-
15
  @app.post("/test/")
16
- async def test_endpoint(message: Message):
17
- response = {"message": f"Received your message: {message.text}"}
 
 
 
18
  return response
19
 
20
  @app.post("/classify/")
 
9
  # Load the image classification pipeline
10
  pipe = pipeline("image-classification", model="mateoluksenberg/dit-base-Classifier_CM05")
11
 
 
 
 
12
  @app.post("/test/")
13
+ async def test_endpoint(message: dict):
14
+ if "text" not in message:
15
+ raise HTTPException(status_code=400, detail="Missing 'text' in request body")
16
+
17
+ response = {"message": f"Received your message: {message['text']}"}
18
  return response
19
 
20
  @app.post("/classify/")