nicolasbuitragob commited on
Commit
2d729d2
·
1 Parent(s): 5093bc2
Files changed (3) hide show
  1. Dockerfile +1 -0
  2. app.py +4 -1
  3. tasks.py +3 -1
Dockerfile CHANGED
@@ -17,5 +17,6 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt
17
  RUN --mount=type=secret,id=API_KEY,mode=0444,required=true
18
  RUN --mount=type=secret,id=API_URL,mode=0444,required=true
19
 
 
20
  COPY --chown=user . /app
21
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
17
  RUN --mount=type=secret,id=API_KEY,mode=0444,required=true
18
  RUN --mount=type=secret,id=API_URL,mode=0444,required=true
19
 
20
+ EXPOSE 7860
21
  COPY --chown=user . /app
22
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
app.py CHANGED
@@ -6,6 +6,9 @@ from dotenv import load_dotenv
6
  from tasks import process_video
7
  from fastapi.responses import JSONResponse
8
  from config import API_KEY
 
 
 
9
  app = FastAPI()
10
  vitpose = VitPose()
11
  # vitpose.pipeline.warmup()
@@ -37,7 +40,7 @@ async def upload(background_tasks: BackgroundTasks,
37
  with open(file.filename, "wb") as f:
38
  f.write(contents)
39
 
40
-
41
 
42
  # Create a clone of the file with content already read
43
  background_tasks.add_task(process_video, file.filename, vitpose, user_id)
 
6
  from tasks import process_video
7
  from fastapi.responses import JSONResponse
8
  from config import API_KEY
9
+ import logging
10
+ logging.basicConfig(level=logging.INFO)
11
+ logger = logging.getLogger(__name__)
12
  app = FastAPI()
13
  vitpose = VitPose()
14
  # vitpose.pipeline.warmup()
 
40
  with open(file.filename, "wb") as f:
41
  f.write(contents)
42
 
43
+ logger.info(f"Uploading video {file.filename}")
44
 
45
  # Create a clone of the file with content already read
46
  background_tasks.add_task(process_video, file.filename, vitpose, user_id)
tasks.py CHANGED
@@ -11,9 +11,11 @@ logger = logging.getLogger(__name__)
11
  def process_video(video_path: str,vitpose: VitPose,user_id: str):
12
 
13
  logger.info(f"Processing video {video_path}")
14
-
 
15
  new_file_name = video_path.split(".")[0] + "edited." + video_path.split(".")[1]
16
  new_file_name = os.path.join("static", new_file_name)
 
17
 
18
  vitpose.output_video_path = new_file_name
19
  annotated_frames = vitpose.run(video_path)
 
11
  def process_video(video_path: str,vitpose: VitPose,user_id: str):
12
 
13
  logger.info(f"Processing video {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)