Spaces:
Runtime error
Runtime error
Upload gradio_app.py
Browse files- gradio_app.py +5 -5
gradio_app.py
CHANGED
@@ -155,7 +155,7 @@ def forward_model(batch, system, guidance_scale=3.0, seed=0, device="cuda"):
|
|
155 |
|
156 |
@spaces.GPU
|
157 |
@torch.inference_mode()
|
158 |
-
def generate_and_process_3d(image: Image.Image
|
159 |
"""Generate image from prompt and convert to 3D model."""
|
160 |
|
161 |
# Generate random seed
|
@@ -217,13 +217,13 @@ def generate_and_process_3d(image: Image.Image, model_dl: list[str]) -> tuple[st
|
|
217 |
|
218 |
trimesh_mesh.export(output_path, file_type="glb", include_normals=True)
|
219 |
|
220 |
-
return output_path
|
221 |
|
222 |
except Exception as e:
|
223 |
print(f"Error during generation: {str(e)}")
|
224 |
import traceback
|
225 |
traceback.print_exc()
|
226 |
-
return None
|
227 |
|
228 |
# Create Gradio app using Blocks
|
229 |
with gr.Blocks() as demo:
|
@@ -244,8 +244,8 @@ with gr.Blocks() as demo:
|
|
244 |
# Event handler
|
245 |
input_img.upload(
|
246 |
fn=generate_and_process_3d,
|
247 |
-
inputs=[input_img
|
248 |
-
outputs=[model_output
|
249 |
api_name="generate"
|
250 |
)
|
251 |
|
|
|
155 |
|
156 |
@spaces.GPU
|
157 |
@torch.inference_mode()
|
158 |
+
def generate_and_process_3d(image: Image.Image) -> tuple[str | None, Image.Image | None]:
|
159 |
"""Generate image from prompt and convert to 3D model."""
|
160 |
|
161 |
# Generate random seed
|
|
|
217 |
|
218 |
trimesh_mesh.export(output_path, file_type="glb", include_normals=True)
|
219 |
|
220 |
+
return output_path
|
221 |
|
222 |
except Exception as e:
|
223 |
print(f"Error during generation: {str(e)}")
|
224 |
import traceback
|
225 |
traceback.print_exc()
|
226 |
+
return None
|
227 |
|
228 |
# Create Gradio app using Blocks
|
229 |
with gr.Blocks() as demo:
|
|
|
244 |
# Event handler
|
245 |
input_img.upload(
|
246 |
fn=generate_and_process_3d,
|
247 |
+
inputs=[input_img],
|
248 |
+
outputs=[model_output],
|
249 |
api_name="generate"
|
250 |
)
|
251 |
|