CoolFace
Apppublic

HouIP/Shap-E

sourceHugging Facemitupdated 3y agoView on Hugging Face
0likes
app.py29 linesDownload Raw Back to root
1#!/usr/bin/env python2 3import os4 5import gradio as gr6import torch7 8from app_image_to_3d import create_demo as create_demo_image_to_3d9from app_text_to_3d import create_demo as create_demo_text_to_3d10from model import Model11 12DESCRIPTION = '# [Shap-E](https://github.com/openai/shap-e)'13 14if (SPACE_ID := os.getenv('SPACE_ID')) is not None:15    DESCRIPTION += f'\n<p>For faster inference without waiting in queue, you may duplicate the space and upgrade to GPU in settings. <a href="https://huggingface.co/spaces/{SPACE_ID}?duplicate=true"><img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space" /></a></p>'16if not torch.cuda.is_available():17    DESCRIPTION += '\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>'18 19model = Model()20 21with gr.Blocks(css='style.css') as demo:22    gr.Markdown(DESCRIPTION)23    with gr.Tabs():24        with gr.Tab(label='Text to 3D'):25            create_demo_text_to_3d(model)26        with gr.Tab(label='Image to 3D'):27            create_demo_image_to_3d(model)28demo.queue(max_size=10).launch()29