Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -22,14 +22,11 @@ client = Client(api_key=os.getenv('OPENAI_API_KEY'),organization=os.getenv('ORG_
|
|
| 22 |
async def batch_processing_result(request: Request, background_tasks: BackgroundTasks):
|
| 23 |
body = await request.json()
|
| 24 |
batch_id = body.get('batch_job_id')
|
| 25 |
-
|
| 26 |
-
# while batch_job.status == 'in_progress':
|
| 27 |
-
batch_job = client.batches.retrieve(batch_id)
|
| 28 |
-
print(batch_job.status)
|
| 29 |
# Add the processing task to background tasks
|
| 30 |
-
if batch_job.status == 'completed':
|
| 31 |
-
|
| 32 |
-
|
| 33 |
|
| 34 |
# Immediately return success response
|
| 35 |
return {'batch_job_status':'notcompleted'}
|
|
|
|
| 22 |
async def batch_processing_result(request: Request, background_tasks: BackgroundTasks):
|
| 23 |
body = await request.json()
|
| 24 |
batch_id = body.get('batch_job_id')
|
| 25 |
+
|
|
|
|
|
|
|
|
|
|
| 26 |
# Add the processing task to background tasks
|
| 27 |
+
# if batch_job.status == 'completed':
|
| 28 |
+
# background_tasks.add_task(process_batch_data, batch_id)
|
| 29 |
+
# return {"batch_job_status":'completed'}
|
| 30 |
|
| 31 |
# Immediately return success response
|
| 32 |
return {'batch_job_status':'notcompleted'}
|