import gradio as gr from t2i_space import get_t2i_space_contents css = """""" with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo: gr.Markdown("# Gradio Text-to-Image Demo Space creation helper") gr.Markdown( f""" **The steps are the following**: - Input text-to-image model Repo ID which you want to use. e.g. 'user/model'. - Click "Submit" and download generated README.md and app.py. - [Create your new Gradio space](https://huggingface.co/new-space) with blank. - Upload README.md and app.py to your space. - If you got 500 error, it happens often, just restart space. - If it does not work no matter how many times you try, there is often a problem with the settings of the original repo itself, or there is no generation function. """ ) with gr.Column(): repo_id = gr.Textbox(label="Model repo ID", placeholder="username/modelname", value="", max_lines=1) run_button = gr.Button(value="Submit") space_file = gr.Files(label="Output", interactive=False) gr.on( triggers=[repo_id.submit, run_button.click], fn=get_t2i_space_contents, inputs=[repo_id], outputs=[space_file], ) demo.queue() demo.launch()