aiqtech commited on
Commit
0d2ef55
β€’
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__":