Vadashuk commited on
Commit
85b17ea
·
verified ·
1 Parent(s): e8937ea

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +1 -113
main.py CHANGED
@@ -491,61 +491,6 @@ async def modelforecast_file(
491
  }
492
  return await _forward_stream("/modelforecast-file/", files=files, data=None, method="POST")
493
 
494
- @app.post("/modelfit-file-demo/")
495
- @GLOBAL_LIMIT
496
- @limiter.limit("10/10minute") # 10 calls per 10 minutes per IP
497
- async def modelfit_file_demo(
498
- request: Request,
499
- file: UploadFile = File(...),
500
- id_col: str = Form(...),
501
- time_col: str = Form(...),
502
- y: str = Form(...),
503
- # optional knobs
504
- lag_y: str = Form(""),
505
- lagged_features: str = Form(""),
506
- current_features: str = Form(""),
507
- filter_by_significance: str = Form("false"),
508
- meanvar_test: str = Form("false"),
509
- ):
510
-
511
- # read once, size-guard it, then forward
512
- raw = await file.read()
513
- if len(raw) > SDK_MAX_BODY_BYTES:
514
- raise HTTPException(status_code=413, detail="Payload too large.")
515
-
516
- files = {
517
- "file": (file.filename, raw, file.content_type or "application/octet-stream"),
518
- }
519
- data = {
520
- "id_col": id_col,
521
- "time_col": time_col,
522
- "y": y,
523
- "lag_y": lag_y,
524
- "lagged_features": lagged_features,
525
- "current_features": current_features,
526
- "filter_by_significance": filter_by_significance,
527
- "meanvar_test": meanvar_test,
528
- }
529
- # the path goes to the private demo route
530
- return await _forward_demo_stream("/modelfit-file-demo/", files=files, data=data, method="POST")
531
-
532
- @app.post("/modelforecast-file-demo/")
533
- @GLOBAL_LIMIT
534
- @limiter.limit("10/10minute")
535
- async def modelforecast_file_demo(
536
- request: Request,
537
- df_forecast: UploadFile = File(...),
538
- ):
539
-
540
- raw = await df_forecast.read()
541
- if len(raw) > SDK_MAX_BODY_BYTES:
542
- raise HTTPException(status_code=413, detail="Payload too large.")
543
-
544
- files = {
545
- "df_forecast": (df_forecast.filename, raw, df_forecast.content_type or "application/octet-stream"),
546
- }
547
- return await _forward_demo_stream("/modelforecast-file-demo/", files=files, data=None, method="POST")
548
-
549
  @app.get("/health-demo-proxy")
550
  async def health_demo_proxy():
551
  # convenience endpoint to test demo proxy hop
@@ -554,61 +499,4 @@ async def health_demo_proxy():
554
  except HTTPException as e:
555
  # bubble up errors so you can diagnose missing config, wrong URL, etc.
556
  raise e
557
-
558
- @app.post("/modelfit_ind/")
559
- async def modelfit_ind(req: Request):
560
- body = await req.json()
561
- return await _forward("/modelfit_ind/", "POST", json_body=body)
562
-
563
- @app.post("/modelforecast_ind/")
564
- async def modelforecast_ind(req: Request):
565
- body = await req.json()
566
- return await _forward("/modelforecast_ind/", "POST", json_body=body)
567
-
568
-
569
- @app.post("/modelfit-file_ind/")
570
- async def modelfit_file_ind(
571
- req: Request,
572
- file: UploadFile = File(...),
573
- id_col: str = Form(...),
574
- time_col: str = Form(...),
575
- y: str = Form(...),
576
- lag_y: str = Form(""),
577
- lagged_features: str = Form(""),
578
- current_features: str = Form(""),
579
- filter_by_significance: str = Form("false"),
580
- meanvar_test: str = Form("false"),
581
- signif: str = Form("0.05"),
582
- ):
583
- raw = await file.read()
584
- if len(raw) > SDK_MAX_BODY_BYTES_extended:
585
- raise HTTPException(status_code=413, detail="Payload too large.")
586
- files = {
587
- "file": (file.filename, raw, file.content_type or "application/octet-stream"),
588
- }
589
- data = {
590
- "id_col": id_col,
591
- "time_col": time_col,
592
- "y": y,
593
- "lag_y": lag_y,
594
- "lagged_features": lagged_features,
595
- "current_features": current_features,
596
- "filter_by_significance": filter_by_significance,
597
- "meanvar_test": meanvar_test,
598
- "signif": signif,
599
- }
600
- return await _forward_stream("/modelfit-file_ind/", files=files, data=data, method="POST")
601
-
602
-
603
- @app.post("/modelforecast-file_ind/")
604
- async def modelforecast_file_ind(
605
- req: Request,
606
- df_forecast: UploadFile = File(...),
607
- ):
608
- raw = await df_forecast.read()
609
- if len(raw) > SDK_MAX_BODY_BYTES_extended:
610
- raise HTTPException(status_code=413, detail="Payload too large.")
611
- files = {
612
- "df_forecast": (df_forecast.filename, raw, df_forecast.content_type or "application/octet-stream"),
613
- }
614
- return await _forward_stream("/modelforecast-file_ind/", files=files, data=None, method="POST")
 
491
  }
492
  return await _forward_stream("/modelforecast-file/", files=files, data=None, method="POST")
493
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494
  @app.get("/health-demo-proxy")
495
  async def health_demo_proxy():
496
  # convenience endpoint to test demo proxy hop
 
499
  except HTTPException as e:
500
  # bubble up errors so you can diagnose missing config, wrong URL, etc.
501
  raise e
502
+