Spaces:
Running
Running
import gradio as gr | |
from t2i_space import get_t2i_space_contents | |
css = """""" | |
with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", css=css) as demo: | |
gr.Markdown("# Gradio Demo Space creation helper") | |
gr.Markdown( | |
f""" | |
**The steps are the following**: | |
- Input 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 / 504 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) | |
with gr.Row(): | |
gradio_version = gr.Textbox(label="Gradio version", placeholder="username/modelname", value="4.44.0", max_lines=1) | |
private_ok = gr.Checkbox(label="Allow private repo", value=True) | |
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, gradio_version, private_ok], | |
outputs=[space_file], | |
) | |
demo.queue() | |
demo.launch() | |