Spaces:
Runtime error
Runtime error
import gradio as gr | |
from gradio_client import Client | |
client = Client("stabilityai/triposr") | |
sdxl = Client("hysts/SD-XL") | |
ABOUT_TEXT = """ | |
# Text-to-3D with TripoSR + SDXL | |
Commercially-viable text-to-3D model. Usage must comply with the SDXL license. | |
For image-to-3D, use [TripoSR](https://huggingface.co/spaces/stabilityai/TripoSR) directly. | |
""".strip() | |
def generate(text): | |
# generate image | |
image = sdxl.predict( | |
text, | |
"", | |
"", | |
"", | |
False, | |
False, | |
False, | |
0, | |
1024, | |
1024, | |
5, | |
5, | |
25, | |
25, | |
False, # bool in 'Apply refiner' Checkbox component | |
api_name="/run" | |
) | |
# preprocess | |
result = client.predict( | |
image, | |
True, | |
0.85, | |
api_name="/preprocess" | |
) | |
result = client.predict( | |
result, | |
api_name="/generate" | |
) | |
return result | |
with gr.Blocks() as demo: | |
gr.Markdown(ABOUT_TEXT) | |
txt = gr.Textbox(interactive=True, label="Text instruction") | |
btn = gr.Button("Generate") | |
out = gr.Model3D( | |
label="3D model", | |
interactive=False, | |
) | |
btn.click(generate, inputs=txt, outputs=out) | |
demo.queue(api_open=False, default_concurrency_limit=20).launch(show_api=False) |