Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -358,6 +358,21 @@ def run_texture(image: Image, mesh_path: str, seed: int, req: gr.Request):
|
|
| 358 |
|
| 359 |
return textured_glb_path
|
| 360 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
HEADER = """
|
| 362 |
# 🌌 PolyGenixAI: Craft 3D Worlds with Cosmic Precision
|
| 363 |
## Unleash Infinite Creativity with AI-Powered 3D Generation by AnvilInteractive Solutions
|
|
@@ -441,7 +456,7 @@ HEADER = """
|
|
| 441 |
</style>
|
| 442 |
"""
|
| 443 |
|
| 444 |
-
# Gradio interface
|
| 445 |
with gr.Blocks(title="PolyGenixAI", css="body { background-color: #1A1A1A; } .gr-panel { background-color: #2D2D2D; }") as demo:
|
| 446 |
gr.Markdown(HEADER)
|
| 447 |
with gr.Tabs(elem_classes="gr-tab"):
|
|
@@ -541,20 +556,6 @@ with gr.Blocks(title="PolyGenixAI", css="body { background-color: #1A1A1A; } .gr
|
|
| 541 |
demo.load(start_session)
|
| 542 |
demo.unload(end_session)
|
| 543 |
|
| 544 |
-
# Gradio API endpoint
|
| 545 |
-
gr.Interface(
|
| 546 |
-
fn=gradio_generate,
|
| 547 |
-
inputs=[
|
| 548 |
-
gr.Image(type="filepath", label="Image"),
|
| 549 |
-
gr.Number(label="Seed", value=0, precision=0),
|
| 550 |
-
gr.Number(label="Inference Steps", value=50, precision=0),
|
| 551 |
-
gr.Number(label="Guidance Scale", value=7.5),
|
| 552 |
-
gr.Checkbox(label="Simplify Mesh", value=True),
|
| 553 |
-
gr.Number(label="Target Face Number", value=DEFAULT_FACE_NUMBER, precision=0)
|
| 554 |
-
],
|
| 555 |
-
outputs="json",
|
| 556 |
-
api_name="/api/generate"
|
| 557 |
-
)
|
| 558 |
-
|
| 559 |
if __name__ == "__main__":
|
|
|
|
| 560 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 358 |
|
| 359 |
return textured_glb_path
|
| 360 |
|
| 361 |
+
# Define Gradio API endpoint separately
|
| 362 |
+
api_interface = gr.Interface(
|
| 363 |
+
fn=gradio_generate,
|
| 364 |
+
inputs=[
|
| 365 |
+
gr.Image(type="filepath", label="Image"),
|
| 366 |
+
gr.Number(label="Seed", value=0, precision=0),
|
| 367 |
+
gr.Number(label="Inference Steps", value=50, precision=0),
|
| 368 |
+
gr.Number(label="Guidance Scale", value=7.5),
|
| 369 |
+
gr.Checkbox(label="Simplify Mesh", value=True),
|
| 370 |
+
gr.Number(label="Target Face Number", value=DEFAULT_FACE_NUMBER, precision=0)
|
| 371 |
+
],
|
| 372 |
+
outputs="json",
|
| 373 |
+
api_name="/api/generate"
|
| 374 |
+
)
|
| 375 |
+
|
| 376 |
HEADER = """
|
| 377 |
# 🌌 PolyGenixAI: Craft 3D Worlds with Cosmic Precision
|
| 378 |
## Unleash Infinite Creativity with AI-Powered 3D Generation by AnvilInteractive Solutions
|
|
|
|
| 456 |
</style>
|
| 457 |
"""
|
| 458 |
|
| 459 |
+
# Gradio web interface
|
| 460 |
with gr.Blocks(title="PolyGenixAI", css="body { background-color: #1A1A1A; } .gr-panel { background-color: #2D2D2D; }") as demo:
|
| 461 |
gr.Markdown(HEADER)
|
| 462 |
with gr.Tabs(elem_classes="gr-tab"):
|
|
|
|
| 556 |
demo.load(start_session)
|
| 557 |
demo.unload(end_session)
|
| 558 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 559 |
if __name__ == "__main__":
|
| 560 |
+
# Launch both the API and web interface
|
| 561 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|