Spaces:
Running
on
L40S
Running
on
L40S
Update gradio_app.py
Browse files- gradio_app.py +6 -16
gradio_app.py
CHANGED
@@ -167,8 +167,12 @@ def forward_model(batch, system, guidance_scale=3.0, seed=0, device="cuda"):
|
|
167 |
|
168 |
return pc_cond
|
169 |
|
170 |
-
def generate_and_process_3d(prompt: str, seed: int = 42
|
171 |
"""Generate image from prompt and convert to 3D model."""
|
|
|
|
|
|
|
|
|
172 |
try:
|
173 |
# Set random seeds
|
174 |
torch.manual_seed(seed)
|
@@ -231,7 +235,7 @@ def generate_and_process_3d(prompt: str, seed: int = 42, width: int = 1024, heig
|
|
231 |
with torch.autocast(device_type='cuda' if torch.cuda.is_available() else 'cpu', dtype=torch.bfloat16):
|
232 |
trimesh_mesh, _ = spar3d_model.generate_mesh(
|
233 |
batch,
|
234 |
-
|
235 |
remesh="none",
|
236 |
vertex_count=-1,
|
237 |
estimate_illumination=True
|
@@ -268,20 +272,6 @@ demo = gr.Interface(
|
|
268 |
maximum=np.iinfo(np.int32).max,
|
269 |
step=1,
|
270 |
value=42
|
271 |
-
),
|
272 |
-
gr.Slider(
|
273 |
-
label="Width",
|
274 |
-
minimum=256,
|
275 |
-
maximum=2048,
|
276 |
-
step=32,
|
277 |
-
value=1024
|
278 |
-
),
|
279 |
-
gr.Slider(
|
280 |
-
label="Height",
|
281 |
-
minimum=256,
|
282 |
-
maximum=2048,
|
283 |
-
step=32,
|
284 |
-
value=1024
|
285 |
)
|
286 |
],
|
287 |
outputs=[
|
|
|
167 |
|
168 |
return pc_cond
|
169 |
|
170 |
+
def generate_and_process_3d(prompt: str, seed: int = 42) -> tuple[str | None, Image.Image | None]:
|
171 |
"""Generate image from prompt and convert to 3D model."""
|
172 |
+
|
173 |
+
width: int = 1024
|
174 |
+
height: int = 1024
|
175 |
+
|
176 |
try:
|
177 |
# Set random seeds
|
178 |
torch.manual_seed(seed)
|
|
|
235 |
with torch.autocast(device_type='cuda' if torch.cuda.is_available() else 'cpu', dtype=torch.bfloat16):
|
236 |
trimesh_mesh, _ = spar3d_model.generate_mesh(
|
237 |
batch,
|
238 |
+
2048, # texture_resolution
|
239 |
remesh="none",
|
240 |
vertex_count=-1,
|
241 |
estimate_illumination=True
|
|
|
272 |
maximum=np.iinfo(np.int32).max,
|
273 |
step=1,
|
274 |
value=42
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
)
|
276 |
],
|
277 |
outputs=[
|