Spaces:
Sleeping
Sleeping
Update app.py
#5
by
sahil-1-garg
- opened
app.py
CHANGED
|
@@ -327,16 +327,16 @@ async def pnl_route(file: UploadFile = File(...), use_rlhf: bool = Query(False))
|
|
| 327 |
|
| 328 |
|
| 329 |
@router.post("/bs")
|
| 330 |
-
async def bs_route(file: UploadFile = File(...), use_rlhf: bool = Query(False)):
|
| 331 |
file_path = f"data/input/{file.filename}"
|
| 332 |
os.makedirs("data/input", exist_ok=True)
|
| 333 |
with open(file_path, "wb") as buffer:
|
| 334 |
shutil.copyfileobj(file.file, buffer)
|
| 335 |
|
| 336 |
if use_rlhf:
|
| 337 |
-
result = run_rlhf_workflow(file_path, "bs")
|
| 338 |
else:
|
| 339 |
-
result = run_workflow(file_path, "bs")
|
| 340 |
|
| 341 |
if result["status"] == "success":
|
| 342 |
output_file = result["result"].get("output_path")
|
|
|
|
| 327 |
|
| 328 |
|
| 329 |
@router.post("/bs")
|
| 330 |
+
async def bs_route(file: UploadFile = File(...), use_rlhf: bool = Query(False), user_api_key: Optional[str] = Form(None)):
|
| 331 |
file_path = f"data/input/{file.filename}"
|
| 332 |
os.makedirs("data/input", exist_ok=True)
|
| 333 |
with open(file_path, "wb") as buffer:
|
| 334 |
shutil.copyfileobj(file.file, buffer)
|
| 335 |
|
| 336 |
if use_rlhf:
|
| 337 |
+
result = run_rlhf_workflow(file_path, "bs", user_api_key=user_api_key)
|
| 338 |
else:
|
| 339 |
+
result = run_workflow(file_path, "bs", user_api_key=user_api_key)
|
| 340 |
|
| 341 |
if result["status"] == "success":
|
| 342 |
output_file = result["result"].get("output_path")
|