Spaces:
Sleeping
Sleeping
seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -4,12 +4,6 @@ import gradio as gr
|
|
4 |
from huggingface_hub import HfApi
|
5 |
import logging
|
6 |
|
7 |
-
try:
|
8 |
-
# ํ์ผ ์ฒ๋ฆฌ ๋ก์ง
|
9 |
-
except Exception as e:
|
10 |
-
logging.error(f"Error processing file: {e}")
|
11 |
-
return "An error occurred during file processing."
|
12 |
-
|
13 |
# ๋ก๊น
์ค์
|
14 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
15 |
|
@@ -29,14 +23,14 @@ def upload_file_to_hf_space(uploaded_file):
|
|
29 |
|
30 |
# ์์ ํ์ผ ์์ฑ ๋ฐ ์
๋ก๋๋ ํ์ผ ๋ฐ์ดํฐ ์ฐ๊ธฐ
|
31 |
with tempfile.NamedTemporaryFile(delete=True, suffix='.mp4') as tmp_file:
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
35 |
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
try:
|
40 |
api.upload_file(
|
41 |
path_or_fileobj=file_path,
|
42 |
path_in_repo=os.path.basename(file_path),
|
|
|
4 |
from huggingface_hub import HfApi
|
5 |
import logging
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
# ๋ก๊น
์ค์
|
8 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
9 |
|
|
|
23 |
|
24 |
# ์์ ํ์ผ ์์ฑ ๋ฐ ์
๋ก๋๋ ํ์ผ ๋ฐ์ดํฐ ์ฐ๊ธฐ
|
25 |
with tempfile.NamedTemporaryFile(delete=True, suffix='.mp4') as tmp_file:
|
26 |
+
try:
|
27 |
+
tmp_file.write(uploaded_file)
|
28 |
+
tmp_file.flush()
|
29 |
+
file_path = tmp_file.name
|
30 |
|
31 |
+
logging.info(f"Uploading {file_path} to Hugging Face Spaces")
|
32 |
|
33 |
+
# Hugging Face Spaces์ ํ์ผ ์
๋ก๋
|
|
|
34 |
api.upload_file(
|
35 |
path_or_fileobj=file_path,
|
36 |
path_in_repo=os.path.basename(file_path),
|