Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -250,12 +250,17 @@ def create_game_html(model_path):
|
|
250 |
"""
|
251 |
return html_template
|
252 |
|
|
|
253 |
def process_upload(glb_file):
|
|
|
|
|
|
|
254 |
# μ
λ‘λλ νμΌ μ²λ¦¬
|
255 |
upload_dir = "uploads"
|
256 |
os.makedirs(upload_dir, exist_ok=True)
|
257 |
|
258 |
-
|
|
|
259 |
dest_path = Path(upload_dir) / file_path.name
|
260 |
shutil.copy(file_path, dest_path)
|
261 |
|
@@ -269,15 +274,21 @@ def process_upload(glb_file):
|
|
269 |
|
270 |
return str(game_path)
|
271 |
|
272 |
-
# Gradio μΈν°νμ΄μ€ μ€μ
|
273 |
iface = gr.Interface(
|
274 |
fn=process_upload,
|
275 |
inputs=[
|
276 |
-
gr.File(
|
|
|
|
|
|
|
|
|
277 |
],
|
278 |
outputs=gr.HTML(label="3D Open World Game"),
|
279 |
title="3D Open World Game Generator",
|
280 |
-
description="Upload your character model (GLB) to create a 3D open world game with WASD controls!"
|
|
|
|
|
281 |
)
|
282 |
|
283 |
if __name__ == "__main__":
|
|
|
250 |
"""
|
251 |
return html_template
|
252 |
|
253 |
+
|
254 |
def process_upload(glb_file):
|
255 |
+
if glb_file is None:
|
256 |
+
return None
|
257 |
+
|
258 |
# μ
λ‘λλ νμΌ μ²λ¦¬
|
259 |
upload_dir = "uploads"
|
260 |
os.makedirs(upload_dir, exist_ok=True)
|
261 |
|
262 |
+
# filepath νμ
μΌλ‘ λ°μ νμΌ μ²λ¦¬
|
263 |
+
file_path = Path(glb_file)
|
264 |
dest_path = Path(upload_dir) / file_path.name
|
265 |
shutil.copy(file_path, dest_path)
|
266 |
|
|
|
274 |
|
275 |
return str(game_path)
|
276 |
|
277 |
+
# Gradio μΈν°νμ΄μ€ μ€μ - typeμ 'filepath'λ‘ λ³κ²½
|
278 |
iface = gr.Interface(
|
279 |
fn=process_upload,
|
280 |
inputs=[
|
281 |
+
gr.File(
|
282 |
+
label="Upload Character Model (GLB)",
|
283 |
+
type="filepath", # 'file' λμ 'filepath' μ¬μ©
|
284 |
+
file_types=[".glb"] # GLB νμΌλ§ νμ©
|
285 |
+
)
|
286 |
],
|
287 |
outputs=gr.HTML(label="3D Open World Game"),
|
288 |
title="3D Open World Game Generator",
|
289 |
+
description="Upload your character model (GLB) to create a 3D open world game with WASD controls!",
|
290 |
+
examples=[], # μμ νμΌμ΄ μλ€λ©΄ μ¬κΈ°μ μΆκ°
|
291 |
+
cache_examples=False
|
292 |
)
|
293 |
|
294 |
if __name__ == "__main__":
|