ishworrsubedii commited on
Commit
c1b007c
·
1 Parent(s): 7f50b11

refactor: model name fetch logic

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -32,7 +32,7 @@ class MakeupColors:
32
 
33
  app = FastAPI()
34
 
35
- RESOURCES_DIR = "/app/resources"
36
 
37
  os.makedirs(RESOURCES_DIR, exist_ok=True)
38
  TEMP_VIDEO_DIR = f"{RESOURCES_DIR}/temp_video"
@@ -295,7 +295,11 @@ async def create_combined_video(request: EachNecklaceVideoGeneratorRequest):
295
  font_path = f"{RESOURCES_DIR}/fonts/{request.font_path}"
296
  audio_path = f"{RESOURCES_DIR}/audio/{request.background_audio_path}"
297
  outro_path = f"{RESOURCES_DIR}/outro/{request.outro_video_path}"
298
- model_name = request.necklace_try_on_output_images[0][0].split("/")[-1].split(".")[0].split("-")[1]
 
 
 
 
299
 
300
  video_creator = EachVideoCreator(
301
  intro_video_path=intro_path,
@@ -360,6 +364,7 @@ async def create_combined_video(request: EachNecklaceVideoGeneratorRequest):
360
  return JSONResponse(content=response, status_code=200)
361
 
362
  except Exception as e:
 
363
  return JSONResponse(content={"status": "error", "message": str(e)}, status_code=500)
364
 
365
 
 
32
 
33
  app = FastAPI()
34
 
35
+ RESOURCES_DIR = "resources"
36
 
37
  os.makedirs(RESOURCES_DIR, exist_ok=True)
38
  TEMP_VIDEO_DIR = f"{RESOURCES_DIR}/temp_video"
 
295
  font_path = f"{RESOURCES_DIR}/fonts/{request.font_path}"
296
  audio_path = f"{RESOURCES_DIR}/audio/{request.background_audio_path}"
297
  outro_path = f"{RESOURCES_DIR}/outro/{request.outro_video_path}"
298
+ try:
299
+ model_name = request.necklace_try_on_output_images[0][0].split("/")[-1].split(".")[0].split("-")[1]
300
+
301
+ except:
302
+ model_name = "MOD"
303
 
304
  video_creator = EachVideoCreator(
305
  intro_video_path=intro_path,
 
364
  return JSONResponse(content=response, status_code=200)
365
 
366
  except Exception as e:
367
+ raise e
368
  return JSONResponse(content={"status": "error", "message": str(e)}, status_code=500)
369
 
370