Spaces:
Paused
Paused
Commit
·
825522e
1
Parent(s):
2d729d2
remove token for a sec
Browse files
app.py
CHANGED
|
@@ -32,15 +32,21 @@ async def upload(background_tasks: BackgroundTasks,
|
|
| 32 |
token: str = Header(...),
|
| 33 |
user_id: str = Body(...)):
|
| 34 |
|
| 35 |
-
|
| 36 |
-
return JSONResponse(content={"message": "Unauthorized", "status": 401})
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
contents = await file.read()
|
| 39 |
-
|
|
|
|
|
|
|
| 40 |
with open(file.filename, "wb") as f:
|
| 41 |
f.write(contents)
|
| 42 |
|
| 43 |
-
logger.info(f"
|
| 44 |
|
| 45 |
# Create a clone of the file with content already read
|
| 46 |
background_tasks.add_task(process_video, file.filename, vitpose, user_id)
|
|
|
|
| 32 |
token: str = Header(...),
|
| 33 |
user_id: str = Body(...)):
|
| 34 |
|
| 35 |
+
logger.info(f"Uploading video {file.filename} {token} {user_id}")
|
|
|
|
| 36 |
|
| 37 |
+
# if token != API_KEY:
|
| 38 |
+
# logger.info(f"Unauthorized {token} {API_KEY}")
|
| 39 |
+
# return JSONResponse(content={"message": "Unauthorized", "status": 401})
|
| 40 |
+
|
| 41 |
+
logger.info("reading contents")
|
| 42 |
contents = await file.read()
|
| 43 |
+
|
| 44 |
+
# Save the file to the local directory
|
| 45 |
+
logger.info("saving file")
|
| 46 |
with open(file.filename, "wb") as f:
|
| 47 |
f.write(contents)
|
| 48 |
|
| 49 |
+
logger.info(f"file saved {file.filename}")
|
| 50 |
|
| 51 |
# Create a clone of the file with content already read
|
| 52 |
background_tasks.add_task(process_video, file.filename, vitpose, user_id)
|
tasks.py
CHANGED
|
@@ -10,12 +10,12 @@ logger = logging.getLogger(__name__)
|
|
| 10 |
|
| 11 |
def process_video(video_path: str,vitpose: VitPose,user_id: str):
|
| 12 |
|
| 13 |
-
logger.info(f"
|
| 14 |
|
| 15 |
|
| 16 |
new_file_name = video_path.split(".")[0] + "edited." + video_path.split(".")[1]
|
| 17 |
new_file_name = os.path.join("static", new_file_name)
|
| 18 |
-
logger.info(f"
|
| 19 |
|
| 20 |
vitpose.output_video_path = new_file_name
|
| 21 |
annotated_frames = vitpose.run(video_path)
|
|
|
|
| 10 |
|
| 11 |
def process_video(video_path: str,vitpose: VitPose,user_id: str):
|
| 12 |
|
| 13 |
+
logger.info(f"starting task {video_path}")
|
| 14 |
|
| 15 |
|
| 16 |
new_file_name = video_path.split(".")[0] + "edited." + video_path.split(".")[1]
|
| 17 |
new_file_name = os.path.join("static", new_file_name)
|
| 18 |
+
logger.info(f"new file name {new_file_name}")
|
| 19 |
|
| 20 |
vitpose.output_video_path = new_file_name
|
| 21 |
annotated_frames = vitpose.run(video_path)
|