TheoLvs commited on
Commit
1c33274
·
1 Parent(s): 70f5f26

Updated API

Browse files
Files changed (3) hide show
  1. tasks/audio.py +3 -1
  2. tasks/image.py +3 -1
  3. tasks/text.py +3 -1
tasks/audio.py CHANGED
@@ -5,8 +5,9 @@ from .utils.emissions import get_space_info
5
  router = APIRouter()
6
 
7
  DESCRIPTION = "Random Baseline"
 
8
 
9
- @router.post("/audio", tags=["Audio Task"],
10
  description=DESCRIPTION)
11
  async def evaluate_audio(request: AudioEvaluationRequest):
12
  """
@@ -22,6 +23,7 @@ async def evaluate_audio(request: AudioEvaluationRequest):
22
  "username": username,
23
  "space_url": space_url,
24
  "model_description": DESCRIPTION,
 
25
  "received_config": {
26
  "dataset_name": request.dataset_name,
27
  "test_size": request.test_size,
 
5
  router = APIRouter()
6
 
7
  DESCRIPTION = "Random Baseline"
8
+ ROUTE = "/audio"
9
 
10
+ @router.post(ROUTE, tags=["Audio Task"],
11
  description=DESCRIPTION)
12
  async def evaluate_audio(request: AudioEvaluationRequest):
13
  """
 
23
  "username": username,
24
  "space_url": space_url,
25
  "model_description": DESCRIPTION,
26
+ "route": ROUTE,
27
  "received_config": {
28
  "dataset_name": request.dataset_name,
29
  "test_size": request.test_size,
tasks/image.py CHANGED
@@ -5,8 +5,9 @@ from .utils.emissions import get_space_info
5
  router = APIRouter()
6
 
7
  DESCRIPTION = "Random Baseline"
 
8
 
9
- @router.post("/image", tags=["Image Task"],
10
  description=DESCRIPTION)
11
  async def evaluate_image(request: ImageEvaluationRequest):
12
  """
@@ -21,6 +22,7 @@ async def evaluate_image(request: ImageEvaluationRequest):
21
  "message": "Image evaluation endpoint not yet implemented",
22
  "username": username,
23
  "space_url": space_url,
 
24
  "model_description": DESCRIPTION,
25
  "received_config": {
26
  "dataset_name": request.dataset_name,
 
5
  router = APIRouter()
6
 
7
  DESCRIPTION = "Random Baseline"
8
+ ROUTE = "/image"
9
 
10
+ @router.post(ROUTE, tags=["Image Task"],
11
  description=DESCRIPTION)
12
  async def evaluate_image(request: ImageEvaluationRequest):
13
  """
 
22
  "message": "Image evaluation endpoint not yet implemented",
23
  "username": username,
24
  "space_url": space_url,
25
+ "route": ROUTE,
26
  "model_description": DESCRIPTION,
27
  "received_config": {
28
  "dataset_name": request.dataset_name,
tasks/text.py CHANGED
@@ -10,8 +10,9 @@ from .utils.emissions import tracker, clean_emissions_data, get_space_info
10
  router = APIRouter()
11
 
12
  DESCRIPTION = "Random Baseline"
 
13
 
14
- @router.post("/text", tags=["Text Task"],
15
  description=DESCRIPTION)
16
  async def evaluate_text(request: TextEvaluationRequest):
17
  """
@@ -80,6 +81,7 @@ async def evaluate_text(request: TextEvaluationRequest):
80
  "energy_consumed_wh": emissions_data.energy_consumed * 1000,
81
  "emissions_gco2eq": emissions_data.emissions * 1000,
82
  "emissions_data": clean_emissions_data(emissions_data),
 
83
  "dataset_config": {
84
  "dataset_name": request.dataset_name,
85
  "test_size": request.test_size,
 
10
  router = APIRouter()
11
 
12
  DESCRIPTION = "Random Baseline"
13
+ ROUTE = "/text"
14
 
15
+ @router.post(ROUTE, tags=["Text Task"],
16
  description=DESCRIPTION)
17
  async def evaluate_text(request: TextEvaluationRequest):
18
  """
 
81
  "energy_consumed_wh": emissions_data.energy_consumed * 1000,
82
  "emissions_gco2eq": emissions_data.emissions * 1000,
83
  "emissions_data": clean_emissions_data(emissions_data),
84
+ "api_route": ROUTE,
85
  "dataset_config": {
86
  "dataset_name": request.dataset_name,
87
  "test_size": request.test_size,