marquesafonso commited on
Commit
1926546
·
verified ·
1 Parent(s): 768256e

add media_type to response

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -69,14 +69,14 @@ async def process_video_api(video_file: UploadFile = File(media_type="video"),
69
  logging.info("Zipping response...")
70
  with open(os.path.join(temp_dir, f"{video_file.filename.split('.')[0]}.zip"), 'w+b') as temp_zip_file:
71
  zip_file = zip_response(temp_zip_file.name, [output_path, srt_path])
72
- return Response(content = zip_file)
73
  with open(os.path.join(temp_dir, f"{video_file.filename.split('.')[0]}.srt"), 'w+b') as temp_srt_file:
74
  logging.info("Processing the video...")
75
  output_path, srt_path = process_video(temp_file.name, None, task, max_words_per_line, fontsize, font, bg_color, text_color, caption_mode)
76
  logging.info("Zipping response...")
77
  with open(os.path.join(temp_dir, f"{video_file.filename.split('.')[0]}.zip"), 'w+b') as temp_zip_file:
78
  zip_file = zip_response(temp_zip_file.name, [output_path, srt_path])
79
- return Response(content = zip_file)
80
  except Exception as e:
81
  raise HTTPException(status_code=500, detail=str(e))
82
 
 
69
  logging.info("Zipping response...")
70
  with open(os.path.join(temp_dir, f"{video_file.filename.split('.')[0]}.zip"), 'w+b') as temp_zip_file:
71
  zip_file = zip_response(temp_zip_file.name, [output_path, srt_path])
72
+ return Response(content = zip_file, media_type = 'application/zip')
73
  with open(os.path.join(temp_dir, f"{video_file.filename.split('.')[0]}.srt"), 'w+b') as temp_srt_file:
74
  logging.info("Processing the video...")
75
  output_path, srt_path = process_video(temp_file.name, None, task, max_words_per_line, fontsize, font, bg_color, text_color, caption_mode)
76
  logging.info("Zipping response...")
77
  with open(os.path.join(temp_dir, f"{video_file.filename.split('.')[0]}.zip"), 'w+b') as temp_zip_file:
78
  zip_file = zip_response(temp_zip_file.name, [output_path, srt_path])
79
+ return Response(content = zip_file, media_type = 'application/zip')
80
  except Exception as e:
81
  raise HTTPException(status_code=500, detail=str(e))
82