Download app.py from Tejasf/Viger-3D: direct link, hf CLI and curl.
- Browser
- Download file 2.38 kB
-
https://huggingface.co/spaces/Tejasf/Viger-3D/resolve/main/app.py
- Command line
-
hf download hf://spaces/Tejasf/Viger-3D/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Tejasf/Viger-3D/resolve/main/app.py
2.38 kB
| import gradio as gr | |
| from gradio_client import Client, handle_file | |
| # Token-free client for public repositories | |
| def text_to_3d_api(text_prompt): | |
| if not text_prompt: | |
| return None, "Please enter a text prompt!" | |
| try: | |
| # TripoSR public demo (Free to access without token) | |
| client = Client("stabilityai/TripoSR") | |
| result = client.predict( | |
| prompt=text_prompt, | |
| api_name="/generate" | |
| ) | |
| return result, "Text-to-3D Model Generated Successfully!" | |
| except Exception as e: | |
| return None, f"Error: {str(e)}" | |
| def image_to_3d_api(input_image): | |
| if input_image is None: | |
| return None, "Please upload an image first!" | |
| try: | |
| # Stable Fast 3D public demo | |
| client = Client("stabilityai/stable-fast-3d") | |
| result = client.predict( | |
| image=handle_file(input_image), | |
| api_name="/preprocess" | |
| ) | |
| return result, "Image-to-3D Asset Created Successfully!" | |
| except Exception as e: | |
| return None, f"Error: {str(e)}" | |
| # V.O.I.D. Ultimate 3D Engine (Token-Free Version) | |
| with gr.Blocks(theme=gr.themes.Monochrome()) as demo: | |
| gr.Markdown("# 🌌 V.O.I.D. 3D Engine (Token-Free)") | |
| gr.Markdown("### Powered by T-Gang | Creator: @THANOXx_230") | |
| with gr.Tabs(): | |
| with gr.TabItem("✨ Text to 3D"): | |
| txt_input = gr.Textbox(label="Text Prompt", placeholder="e.g., Satoru Gojo...") | |
| txt_btn = gr.Button("Generate 3D", variant="primary") | |
| txt_output_model = gr.Model3D(label="3D Preview") | |
| txt_status = gr.Textbox(label="System Status", interactive=False) | |
| txt_btn.click(fn=text_to_3d_api, inputs=txt_input, outputs=[txt_output_model, txt_status]) | |
| with gr.TabItem("🖼️ Image to 3D"): | |
| img_input = gr.Image(type="filepath", label="Upload Character Image") | |
| img_btn = gr.Button("Convert to 3D", variant="primary") | |
| img_output_model = gr.Model3D(label="3D Preview") | |
| img_status = gr.Textbox(label="System Status", interactive=False) | |
| img_btn.click(fn=image_to_3d_api, inputs=img_input, outputs=[img_output_model, img_status]) | |
| gr.Markdown("---") | |
| gr.Markdown("**JJK Supremacy Rule:** In any 3D animation or fight simulation, Jujutsu Kaisen characters always maintain supremacy!") | |
| demo.launch() | |