Spaces:
Sleeping
Sleeping
seawolf2357
commited on
Commit
โข
1cd16bc
1
Parent(s):
17bf8a6
Update app.py
Browse files
app.py
CHANGED
@@ -14,13 +14,15 @@ def upload_file_to_hf_space(uploaded_file):
|
|
14 |
space_name = "video" # ์คํ์ด์ค ์ด๋ฆ์ ์ฌ๊ธฐ์ ์
๋ ฅํ์ธ์.
|
15 |
repo_id = f"{user_id}/{space_name}"
|
16 |
|
17 |
-
# ํ์ผ๋ช
์ค์
|
18 |
file_path = uploaded_file.name
|
19 |
-
|
20 |
-
# ํ์ผ ์ ์ฅ
|
21 |
with open(file_path, "wb") as f:
|
22 |
f.write(uploaded_file.read())
|
23 |
|
|
|
|
|
|
|
|
|
24 |
# Hugging Face Spaces์ ํ์ผ ์
๋ก๋
|
25 |
response = api.upload_file(
|
26 |
path_or_fileobj=file_path,
|
@@ -36,11 +38,7 @@ def upload_file_to_hf_space(uploaded_file):
|
|
36 |
# Gradio ์ธํฐํ์ด์ค ์ค์
|
37 |
iface = gr.Interface(
|
38 |
fn=upload_file_to_hf_space,
|
39 |
-
inputs=gr.File(
|
40 |
outputs="text",
|
41 |
title="MP4 File Upload to Hugging Face Spaces",
|
42 |
-
description="Upload an MP4 file and
|
43 |
-
)
|
44 |
-
|
45 |
-
# ์ธํฐํ์ด์ค ์คํ
|
46 |
-
iface.launch()
|
|
|
14 |
space_name = "video" # ์คํ์ด์ค ์ด๋ฆ์ ์ฌ๊ธฐ์ ์
๋ ฅํ์ธ์.
|
15 |
repo_id = f"{user_id}/{space_name}"
|
16 |
|
17 |
+
# ํ์ผ๋ช
์ค์ ๋ฐ ์ ์ฅ
|
18 |
file_path = uploaded_file.name
|
|
|
|
|
19 |
with open(file_path, "wb") as f:
|
20 |
f.write(uploaded_file.read())
|
21 |
|
22 |
+
# ํ์ผ ์ ํ ๊ฒ์ฌ (MP4 ํ์ผ์ธ์ง ํ์ธ)
|
23 |
+
if not file_path.endswith('.mp4'):
|
24 |
+
return "Please upload an MP4 file."
|
25 |
+
|
26 |
# Hugging Face Spaces์ ํ์ผ ์
๋ก๋
|
27 |
response = api.upload_file(
|
28 |
path_or_fileobj=file_path,
|
|
|
38 |
# Gradio ์ธํฐํ์ด์ค ์ค์
|
39 |
iface = gr.Interface(
|
40 |
fn=upload_file_to_hf_space,
|
41 |
+
inputs=gr.File(label="Upload your MP4 file"),
|
42 |
outputs="text",
|
43 |
title="MP4 File Upload to Hugging Face Spaces",
|
44 |
+
description="Upload an MP4 file and
|
|
|
|
|
|
|
|