aiqtech commited on
Commit
0d2ef55
ยท
verified ยท
1 Parent(s): 10e0fb7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
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
- file_path = Path(glb_file.name)
 
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(label="Upload Character Model (GLB)", type="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__":