Tonic commited on
Commit
0ee5862
·
unverified ·
1 Parent(s): 288d8d7

improve submission

Browse files
Files changed (2) hide show
  1. app.py +5 -12
  2. tasks/text.py +6 -1
app.py CHANGED
@@ -1,6 +1,6 @@
1
  from fastapi import FastAPI
2
  from dotenv import load_dotenv
3
- from tasks import text, image, audio
4
 
5
  # Load environment variables
6
  load_dotenv()
@@ -9,26 +9,19 @@ app = FastAPI(
9
  title="Frugal AI Challenge API",
10
  description="API for the Frugal AI Challenge evaluation endpoints"
11
  )
12
- from fastapi import FastAPI
13
- from tasks.text import router as text_router
14
 
15
  @app.get("/health")
16
  async def health_check():
17
  return {"status": "ok"}
18
 
19
- app.include_router(text_router)
20
- # Include all routers
21
- # app.include_router(text.router)
22
- # app.include_router(image.router)
23
- # app.include_router(audio.router)
24
 
25
  @app.get("/")
26
  async def root():
27
  return {
28
  "message": "Welcome to the Frugal AI Challenge API",
29
  "endpoints": {
30
- "text": "/text - Text classification task"#,
31
- # "image": "/image - Image classification task (coming soon)",
32
- # "audio": "/audio - Audio classification task (coming soon)"
33
  }
34
- }
 
1
  from fastapi import FastAPI
2
  from dotenv import load_dotenv
3
+ from tasks import text
4
 
5
  # Load environment variables
6
  load_dotenv()
 
9
  title="Frugal AI Challenge API",
10
  description="API for the Frugal AI Challenge evaluation endpoints"
11
  )
 
 
12
 
13
  @app.get("/health")
14
  async def health_check():
15
  return {"status": "ok"}
16
 
17
+ # Include text router
18
+ app.include_router(text.router)
 
 
 
19
 
20
  @app.get("/")
21
  async def root():
22
  return {
23
  "message": "Welcome to the Frugal AI Challenge API",
24
  "endpoints": {
25
+ "text": "/text - Text classification task"
 
 
26
  }
27
+ }
tasks/text.py CHANGED
@@ -143,4 +143,9 @@ async def evaluate_text(request: TextEvaluationRequest):
143
 
144
  except Exception as e:
145
  logger.error(f"Error during evaluation: {str(e)}")
146
- stop_tracking()
 
 
 
 
 
 
143
 
144
  except Exception as e:
145
  logger.error(f"Error during evaluation: {str(e)}")
146
+ stop_tracking()
147
+ raise HTTPException(status_code=500, detail=str(e))
148
+
149
+ except Exception as e:
150
+ logger.error(f"Error in evaluate_text: {str(e)}")
151
+ raise HTTPException(status_code=500, detail=str(e))