imseldrith commited on
Commit
cae88b4
1 Parent(s): 4e97e44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -2,6 +2,7 @@ from flask import Flask, request, render_template, send_file
2
  import moviepy.editor as mp
3
  import os
4
  import cv2
 
5
  from gtts import gTTS
6
  import numpy as np
7
  from progress.bar import Bar
@@ -19,8 +20,10 @@ def dub():
19
  # Check if a video was uploaded
20
  if "video" in request.files:
21
  video = request.files["video"]
22
- filename = video.filename
23
- video.save(os.path.join(app.config["TEMP_FOLDER"], filename))
 
 
24
  else:
25
  # Get video from URL
26
  url = request.form["url"]
 
2
  import moviepy.editor as mp
3
  import os
4
  import cv2
5
+ import tempfile
6
  from gtts import gTTS
7
  import numpy as np
8
  from progress.bar import Bar
 
20
  # Check if a video was uploaded
21
  if "video" in request.files:
22
  video = request.files["video"]
23
+ filename = tempfile.NamedTemporaryFile(dir=app.config["TEMP_FOLDER"], delete=False).name
24
+ video.save(filename)
25
+ #filename = video.filename
26
+ #video.save(os.path.join(app.config["TEMP_FOLDER"], filename))
27
  else:
28
  # Get video from URL
29
  url = request.form["url"]