Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -190,7 +190,6 @@ def process_vox_file(vox_file) -> Tuple[str, str]:
|
|
| 190 |
return "", f"Error: {str(e)}"
|
| 191 |
|
| 192 |
def create_gradio_interface():
|
| 193 |
-
# FIXED: Move theme parameter to launch() method for Gradio 6.0
|
| 194 |
with gr.Blocks(title="VOX to GLB Converter with Preview") as app:
|
| 195 |
gr.Markdown("""
|
| 196 |
# 🧊 MagicaVoxel VOX to GLB Converter with 3D Preview
|
|
@@ -206,18 +205,18 @@ def create_gradio_interface():
|
|
| 206 |
with gr.Column():
|
| 207 |
glb_output = gr.File(label="Download GLB File", file_types=[".glb"], interactive=False)
|
| 208 |
|
| 209 |
-
# 3D Preview Section -
|
| 210 |
gr.Markdown("### 🎮 3D Preview")
|
| 211 |
|
| 212 |
-
# Use
|
| 213 |
model_3d = gr.Model3D(
|
| 214 |
label="GLB Preview",
|
| 215 |
height=300
|
| 216 |
)
|
| 217 |
|
| 218 |
# Connect conversion to preview
|
| 219 |
-
def convert_with_preview(
|
| 220 |
-
glb_path, message = process_vox_file(
|
| 221 |
if glb_path and os.path.exists(glb_path):
|
| 222 |
return glb_path, message, glb_path # Return path for both file and 3D viewer
|
| 223 |
else:
|
|
@@ -225,7 +224,7 @@ def create_gradio_interface():
|
|
| 225 |
|
| 226 |
convert_btn.click(
|
| 227 |
fn=convert_with_preview,
|
| 228 |
-
inputs=[
|
| 229 |
outputs=[glb_output, status_output, model_3d]
|
| 230 |
)
|
| 231 |
|
|
@@ -241,7 +240,6 @@ def create_gradio_interface():
|
|
| 241 |
|
| 242 |
if __name__ == "__main__":
|
| 243 |
app = create_gradio_interface()
|
| 244 |
-
# FIXED: Move theme parameter to launch() method for Gradio 6.0
|
| 245 |
app.launch(
|
| 246 |
server_name="0.0.0.0",
|
| 247 |
server_port=7860,
|
|
|
|
| 190 |
return "", f"Error: {str(e)}"
|
| 191 |
|
| 192 |
def create_gradio_interface():
|
|
|
|
| 193 |
with gr.Blocks(title="VOX to GLB Converter with Preview") as app:
|
| 194 |
gr.Markdown("""
|
| 195 |
# 🧊 MagicaVoxel VOX to GLB Converter with 3D Preview
|
|
|
|
| 205 |
with gr.Column():
|
| 206 |
glb_output = gr.File(label="Download GLB File", file_types=[".glb"], interactive=False)
|
| 207 |
|
| 208 |
+
# 3D Preview Section - Using Gradio's built-in 3D viewer
|
| 209 |
gr.Markdown("### 🎮 3D Preview")
|
| 210 |
|
| 211 |
+
# FIXED: Use correct variable name
|
| 212 |
model_3d = gr.Model3D(
|
| 213 |
label="GLB Preview",
|
| 214 |
height=300
|
| 215 |
)
|
| 216 |
|
| 217 |
# Connect conversion to preview
|
| 218 |
+
def convert_with_preview(vox_input):
|
| 219 |
+
glb_path, message = process_vox_file(vox_input)
|
| 220 |
if glb_path and os.path.exists(glb_path):
|
| 221 |
return glb_path, message, glb_path # Return path for both file and 3D viewer
|
| 222 |
else:
|
|
|
|
| 224 |
|
| 225 |
convert_btn.click(
|
| 226 |
fn=convert_with_preview,
|
| 227 |
+
inputs=[vox_input], # FIXED: Use correct variable name
|
| 228 |
outputs=[glb_output, status_output, model_3d]
|
| 229 |
)
|
| 230 |
|
|
|
|
| 240 |
|
| 241 |
if __name__ == "__main__":
|
| 242 |
app = create_gradio_interface()
|
|
|
|
| 243 |
app.launch(
|
| 244 |
server_name="0.0.0.0",
|
| 245 |
server_port=7860,
|