xclasscode commited on
Commit
8a1ff67
·
verified ·
1 Parent(s): e98550b

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -26,16 +26,16 @@ def get_db():
26
  db.close()
27
 
28
  @app.post("/analyze_sentiment")
29
- def create_sentiment_result(sentiment_result: schemas.SentimentResultCreate,text_input: str,db: Session = Depends(get_db))->JSONResponse:
30
  try:
31
  # Perform input validation
32
- if not isinstance(text_input, str) or not text_input.strip():
33
  raise HTTPException(
34
  status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
35
  detail="Invalid text input"
36
  )
37
 
38
- text_content = text_input
39
  sentiment_analysis_result = pipe(text_content)
40
 
41
  # Create a new SentimentResult instance
 
26
  db.close()
27
 
28
  @app.post("/analyze_sentiment")
29
+ def create_sentiment_result(sentiment_result: schemas.SentimentResultCreate,db: Session = Depends(get_db))->JSONResponse:
30
  try:
31
  # Perform input validation
32
+ if not isinstance(sentiment_result.text_input, str) or not sentiment_result.text_input.strip():
33
  raise HTTPException(
34
  status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
35
  detail="Invalid text input"
36
  )
37
 
38
+ text_content = sentiment_result.text_input
39
  sentiment_analysis_result = pipe(text_content)
40
 
41
  # Create a new SentimentResult instance