fix: Update app
Browse files
app.py
CHANGED
|
@@ -42,8 +42,8 @@ def generate_3d(image, seed=-1,
|
|
| 42 |
seed = np.random.randint(0, MAX_SEED)
|
| 43 |
|
| 44 |
image = pipeline.preprocess_image(image, resolution=1024)
|
| 45 |
-
|
| 46 |
-
|
| 47 |
outputs = pipeline.run(
|
| 48 |
normal_image,
|
| 49 |
seed=seed,
|
|
@@ -167,7 +167,7 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
|
|
| 167 |
output_gallery = gr.Gallery(label="Examples", columns=4, rows=2, object_fit="contain", height="auto",show_label=False)
|
| 168 |
with gr.Tab("3D Model"):
|
| 169 |
with gr.Column():
|
| 170 |
-
model_output =
|
| 171 |
with gr.Column():
|
| 172 |
export_format = gr.Dropdown(
|
| 173 |
choices=["obj", "glb", "ply", "stl"],
|
|
@@ -222,10 +222,11 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
|
|
| 222 |
|
| 223 |
if __name__ == "__main__":
|
| 224 |
# Initialize pipeline
|
| 225 |
-
pipeline = TrellisImageTo3DPipeline.from_pretrained("
|
| 226 |
-
|
|
|
|
| 227 |
# Initialize normal predictor
|
| 228 |
-
|
| 229 |
|
| 230 |
# Launch the app
|
| 231 |
demo.launch()
|
|
|
|
| 42 |
seed = np.random.randint(0, MAX_SEED)
|
| 43 |
|
| 44 |
image = pipeline.preprocess_image(image, resolution=1024)
|
| 45 |
+
normal_image = normal_predictor(image, resolution=768, match_input_resolution=True, data_type='object')
|
| 46 |
+
|
| 47 |
outputs = pipeline.run(
|
| 48 |
normal_image,
|
| 49 |
seed=seed,
|
|
|
|
| 167 |
output_gallery = gr.Gallery(label="Examples", columns=4, rows=2, object_fit="contain", height="auto",show_label=False)
|
| 168 |
with gr.Tab("3D Model"):
|
| 169 |
with gr.Column():
|
| 170 |
+
model_output = gr.Model3D(label="3D Model Preview", height=300)
|
| 171 |
with gr.Column():
|
| 172 |
export_format = gr.Dropdown(
|
| 173 |
choices=["obj", "glb", "ply", "stl"],
|
|
|
|
| 222 |
|
| 223 |
if __name__ == "__main__":
|
| 224 |
# Initialize pipeline
|
| 225 |
+
pipeline = TrellisImageTo3DPipeline.from_pretrained("Stable-X/trellis-normal-v0-1")
|
| 226 |
+
pipeline.cuda()
|
| 227 |
+
|
| 228 |
# Initialize normal predictor
|
| 229 |
+
normal_predictor = torch.hub.load("hugoycj/StableNormal", "StableNormal_turbo", trust_repo=True, yoso_version='yoso-normal-v1-8-1')
|
| 230 |
|
| 231 |
# Launch the app
|
| 232 |
demo.launch()
|