Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,13 +2,16 @@ import gradio as gr
|
|
| 2 |
from huggingface_hub import HfApi
|
| 3 |
import os
|
| 4 |
|
|
|
|
| 5 |
api = HfApi(token=os.getenv("HF_API_TOKEN"))
|
| 6 |
|
| 7 |
def upload_video(video):
|
| 8 |
# Save the uploaded video to a temporary file
|
| 9 |
video_path = os.path.join("temp", video.name)
|
|
|
|
|
|
|
| 10 |
with open(video_path, "wb") as f:
|
| 11 |
-
f.write(video.read()
|
| 12 |
|
| 13 |
# Upload the video to Hugging Face
|
| 14 |
api.upload_file(
|
|
|
|
| 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"))
|
| 7 |
|
| 8 |
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 binary content
|
| 13 |
with open(video_path, "wb") as f:
|
| 14 |
+
f.write(video.read_bytes()) # Use read_bytes() instead of read()
|
| 15 |
|
| 16 |
# Upload the video to Hugging Face
|
| 17 |
api.upload_file(
|