Spaces:
Sleeping
Sleeping
Adjusted forward to datfid_api_webpage space by including session_id as required input
Browse files
main.py
CHANGED
|
@@ -852,6 +852,7 @@ async def modelfit_file_demo(
|
|
| 852 |
current_features: str = Form(""),
|
| 853 |
filter_by_significance: str = Form("false"),
|
| 854 |
meanvar_test: str = Form("false"),
|
|
|
|
| 855 |
):
|
| 856 |
|
| 857 |
# read once, size-guard it, then forward
|
|
@@ -859,6 +860,10 @@ async def modelfit_file_demo(
|
|
| 859 |
if len(raw) > SDK_MAX_BODY_BYTES:
|
| 860 |
raise HTTPException(status_code=413, detail="Payload too large.")
|
| 861 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 862 |
files = {
|
| 863 |
"file": (file.filename, raw, file.content_type or "application/octet-stream"),
|
| 864 |
}
|
|
@@ -871,6 +876,7 @@ async def modelfit_file_demo(
|
|
| 871 |
"current_features": current_features,
|
| 872 |
"filter_by_significance": filter_by_significance,
|
| 873 |
"meanvar_test": meanvar_test,
|
|
|
|
| 874 |
}
|
| 875 |
# the path goes to the private demo route
|
| 876 |
return await _forward_demo_stream("/modelfit-file-demo/", files=files, data=data, method="POST")
|
|
@@ -881,16 +887,25 @@ async def modelfit_file_demo(
|
|
| 881 |
async def modelforecast_file_demo(
|
| 882 |
request: Request,
|
| 883 |
df_forecast: UploadFile = File(...),
|
|
|
|
| 884 |
):
|
| 885 |
|
| 886 |
raw = await df_forecast.read()
|
| 887 |
if len(raw) > SDK_MAX_BODY_BYTES:
|
| 888 |
raise HTTPException(status_code=413, detail="Payload too large.")
|
| 889 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 890 |
files = {
|
| 891 |
"df_forecast": (df_forecast.filename, raw, df_forecast.content_type or "application/octet-stream"),
|
| 892 |
}
|
| 893 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 894 |
|
| 895 |
@app.get("/health-demo-proxy")
|
| 896 |
async def health_demo_proxy():
|
|
|
|
| 852 |
current_features: str = Form(""),
|
| 853 |
filter_by_significance: str = Form("false"),
|
| 854 |
meanvar_test: str = Form("false"),
|
| 855 |
+
session_id: str = Form(...),
|
| 856 |
):
|
| 857 |
|
| 858 |
# read once, size-guard it, then forward
|
|
|
|
| 860 |
if len(raw) > SDK_MAX_BODY_BYTES:
|
| 861 |
raise HTTPException(status_code=413, detail="Payload too large.")
|
| 862 |
|
| 863 |
+
sid = session_id.strip()
|
| 864 |
+
if not sid:
|
| 865 |
+
raise HTTPException(status_code=400, detail="Missing session_id")
|
| 866 |
+
|
| 867 |
files = {
|
| 868 |
"file": (file.filename, raw, file.content_type or "application/octet-stream"),
|
| 869 |
}
|
|
|
|
| 876 |
"current_features": current_features,
|
| 877 |
"filter_by_significance": filter_by_significance,
|
| 878 |
"meanvar_test": meanvar_test,
|
| 879 |
+
"session_id": sid,
|
| 880 |
}
|
| 881 |
# the path goes to the private demo route
|
| 882 |
return await _forward_demo_stream("/modelfit-file-demo/", files=files, data=data, method="POST")
|
|
|
|
| 887 |
async def modelforecast_file_demo(
|
| 888 |
request: Request,
|
| 889 |
df_forecast: UploadFile = File(...),
|
| 890 |
+
session_id: str = Form(...),
|
| 891 |
):
|
| 892 |
|
| 893 |
raw = await df_forecast.read()
|
| 894 |
if len(raw) > SDK_MAX_BODY_BYTES:
|
| 895 |
raise HTTPException(status_code=413, detail="Payload too large.")
|
| 896 |
|
| 897 |
+
sid = session_id.strip()
|
| 898 |
+
if not sid:
|
| 899 |
+
raise HTTPException(status_code=400, detail="Missing session_id")
|
| 900 |
+
|
| 901 |
files = {
|
| 902 |
"df_forecast": (df_forecast.filename, raw, df_forecast.content_type or "application/octet-stream"),
|
| 903 |
}
|
| 904 |
+
data = {
|
| 905 |
+
"session_id": sid,
|
| 906 |
+
}
|
| 907 |
+
|
| 908 |
+
return await _forward_demo_stream("/modelforecast-file-demo/", files=files, data=data, method="POST")
|
| 909 |
|
| 910 |
@app.get("/health-demo-proxy")
|
| 911 |
async def health_demo_proxy():
|