Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -13,12 +13,15 @@ def download_file(url, destination):
|
|
13 |
with open(destination, 'wb') as f:
|
14 |
f.write(response.content)
|
15 |
|
|
|
|
|
16 |
def get_input_path(video_file, video_url, temp_dir):
|
17 |
"""Returns the path to the video file, downloading it if necessary."""
|
18 |
if video_file is not None:
|
19 |
return Path(video_file.name)
|
20 |
elif video_url:
|
21 |
-
|
|
|
22 |
destination = temp_dir / file_name
|
23 |
download_file(video_url, destination)
|
24 |
return destination
|
|
|
13 |
with open(destination, 'wb') as f:
|
14 |
f.write(response.content)
|
15 |
|
16 |
+
from urllib.parse import urlparse
|
17 |
+
|
18 |
def get_input_path(video_file, video_url, temp_dir):
|
19 |
"""Returns the path to the video file, downloading it if necessary."""
|
20 |
if video_file is not None:
|
21 |
return Path(video_file.name)
|
22 |
elif video_url:
|
23 |
+
url_path = urlparse(video_url).path
|
24 |
+
file_name = Path(url_path).name
|
25 |
destination = temp_dir / file_name
|
26 |
download_file(video_url, destination)
|
27 |
return destination
|