Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import HfApi
|
3 |
import os
|
|
|
4 |
|
5 |
# Initialize the Hugging Face API with the token
|
6 |
api = HfApi(token=os.getenv("HF_API_TOKEN"))
|
@@ -9,10 +10,10 @@ def upload_video(video):
|
|
9 |
# Save the uploaded video to a temporary file
|
10 |
video_path = os.path.join("temp", video.name)
|
11 |
|
12 |
-
# Write the file from the
|
13 |
with open(video_path, "wb") as f:
|
14 |
-
|
15 |
-
|
16 |
# Upload the video to Hugging Face
|
17 |
api.upload_file(
|
18 |
path_or_fileobj=video_path,
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import HfApi
|
3 |
import os
|
4 |
+
import shutil
|
5 |
|
6 |
# Initialize the Hugging Face API with the token
|
7 |
api = HfApi(token=os.getenv("HF_API_TOKEN"))
|
|
|
10 |
# Save the uploaded video to a temporary file
|
11 |
video_path = os.path.join("temp", video.name)
|
12 |
|
13 |
+
# Write the file from the uploaded content
|
14 |
with open(video_path, "wb") as f:
|
15 |
+
shutil.copyfileobj(video, f) # Use shutil.copyfileobj to write the file
|
16 |
+
|
17 |
# Upload the video to Hugging Face
|
18 |
api.upload_file(
|
19 |
path_or_fileobj=video_path,
|