Commit ·
fe650c7
1
Parent(s): 92fb831
global key concurrency problem
Browse files69 unmodified lines707172737475767778798081310 unmodified lines39239339439539639739839969 unmodified linesprint(f"[DEBUG] Model endpoint: {model_endpoint}")print(f"[DEBUG] Arguments: {json.dumps(fal_arguments, indent=2)[:500]}...") # First 500 chars# Set API key for this requestos.environ['FAL_KEY'] = api_key# Submit the request asynchronouslyprint(f"[DEBUG] Submitting to FAL API...")handler = await fal_client.submit_async(model_endpoint,arguments=fal_arguments,)310 unmodified linesasync def upload_file_to_fal_async(file_path, api_key):"""Helper function to upload a file to FAL storage"""os.environ['FAL_KEY'] = api_keyreturn await fal_client.upload_file_async(file_path)def upload_to_fal_sync(file_path, api_key):"""Run upload coroutine on the shared background event loop"""69 unmodified lines70717273747576777879808182310 unmodified lines39339439539639739839940040169 unmodified linesprint(f"[DEBUG] Model endpoint: {model_endpoint}")print(f"[DEBUG] Arguments: {json.dumps(fal_arguments, indent=2)[:500]}...") # First 500 chars# Build per-request client with explicit key to avoid global env mutationprint(f"[DEBUG] Creating AsyncClient with per-request key (not using env var)")client = fal_client.AsyncClient(key=api_key)# Submit the request asynchronously using the per-request clientprint(f"[DEBUG] Submitting to FAL API via AsyncClient.submit...")handler = await client.submit(model_endpoint,arguments=fal_arguments,)310 unmodified linesasync def upload_file_to_fal_async(file_path, api_key):"""Helper function to upload a file to FAL storage"""# Use per-request AsyncClient with explicit key to avoid global env mutationclient = fal_client.AsyncClient(key=api_key)return await client.upload_file(file_path)def upload_to_fal_sync(file_path, api_key):"""Run upload coroutine on the shared background event loop"""
app.py+10-8