File size: 1,217 Bytes
c51d587
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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()