John6666 commited on
Commit
406daa0
1 Parent(s): 9b199dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -46
app.py CHANGED
@@ -1,46 +1,46 @@
1
- import gradio as gr
2
- from t2i_space import get_t2i_space_contents
3
-
4
- css = """
5
- .title { text-align: center; }
6
- """
7
-
8
- with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", fill_width=True, css=css) as demo:
9
- gr.Markdown("# Gradio Demo Space creation helper V2", elem_classes="title")
10
- gr.Markdown(
11
- f"""
12
- **The steps are the following**:
13
- - Input model Repo ID which you want to use. e.g. 'user/model'.
14
- - Click "Submit" and download generated README.md and app.py.
15
- - [Create your new Gradio space](https://huggingface.co/new-space) with blank.
16
- - Upload README.md and app.py to your space.
17
- - If you got 500 / 504 error, it happens often, just restart space.
18
- - 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.
19
- """
20
- )
21
- with gr.Column():
22
- repo_id = gr.Textbox(label="Model repo ID", placeholder="username/modelname", value="", max_lines=1)
23
- with gr.Accordion("Advanced", open=False):
24
- with gr.Row():
25
- gradio_version = gr.Textbox(label="Gradio version", placeholder="username/modelname", value="5.0.1", max_lines=1)
26
- private_ok = gr.Checkbox(label="Allow private repo", value=True)
27
- with gr.Row():
28
- hf_user = gr.Textbox(label="Your HF user ID (Optional)", placeholder="username", value="", max_lines=1)
29
- hf_repo = gr.Textbox(label="New space name (Optional)", placeholder="spacename", info="If empty, auto-complete", value="", max_lines=1)
30
- hf_token = gr.Textbox(label="Your HF write token (Optional)", placeholder="hf_...", value="", max_lines=1)
31
- with gr.Row():
32
- is_private = gr.Checkbox(label="Create private repo (Optional)", value=True)
33
- is_setkey = gr.Checkbox(label="Set your token to space (Optional)", info="For private / gated models", value=False)
34
- run_button = gr.Button(value="Submit")
35
- space_file = gr.Files(label="Output", interactive=False)
36
- output_md = gr.Markdown(label="Output")
37
-
38
- gr.on(
39
- triggers=[repo_id.submit, run_button.click],
40
- fn=get_t2i_space_contents,
41
- inputs=[repo_id, gradio_version, private_ok, hf_user, hf_repo, is_private, is_setkey, hf_token],
42
- outputs=[space_file, output_md],
43
- )
44
-
45
- demo.queue()
46
- demo.launch()
 
1
+ import gradio as gr
2
+ from t2i_space import get_t2i_space_contents
3
+
4
+ css = """
5
+ .title { text-align: center; }
6
+ """
7
+
8
+ with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", fill_width=True, css=css) as demo:
9
+ gr.Markdown("# Gradio Demo Space creation helper V2", elem_classes="title")
10
+ gr.Markdown(
11
+ f"""
12
+ **The steps are the following**:
13
+ - Input model Repo ID which you want to use. e.g. 'user/model'.
14
+ - Click "Submit" and download generated README.md and app.py.
15
+ - [Create your new Gradio space](https://huggingface.co/new-space) with blank.
16
+ - Upload README.md and app.py to your space.
17
+ - If you got 500 / 504 error, it happens often, just restart space.
18
+ - 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.
19
+ """
20
+ )
21
+ with gr.Column():
22
+ repo_id = gr.Textbox(label="Model repo ID", placeholder="username/modelname", value="", max_lines=1)
23
+ with gr.Accordion("Advanced", open=False):
24
+ with gr.Row():
25
+ gradio_version = gr.Textbox(label="Gradio version", placeholder="username/modelname", value="5.7.0", max_lines=1)
26
+ private_ok = gr.Checkbox(label="Allow private repo", value=True)
27
+ with gr.Row():
28
+ hf_user = gr.Textbox(label="Your HF user ID (Optional)", placeholder="username", value="", max_lines=1)
29
+ hf_repo = gr.Textbox(label="New space name (Optional)", placeholder="spacename", info="If empty, auto-complete", value="", max_lines=1)
30
+ hf_token = gr.Textbox(label="Your HF write token (Optional)", placeholder="hf_...", value="", max_lines=1)
31
+ with gr.Row():
32
+ is_private = gr.Checkbox(label="Create private repo (Optional)", value=True)
33
+ is_setkey = gr.Checkbox(label="Set your token to space (Optional)", info="For private / gated models", value=False)
34
+ run_button = gr.Button(value="Submit")
35
+ space_file = gr.Files(label="Output", interactive=False)
36
+ output_md = gr.Markdown(label="Output")
37
+
38
+ gr.on(
39
+ triggers=[repo_id.submit, run_button.click],
40
+ fn=get_t2i_space_contents,
41
+ inputs=[repo_id, gradio_version, private_ok, hf_user, hf_repo, is_private, is_setkey, hf_token],
42
+ outputs=[space_file, output_md],
43
+ )
44
+
45
+ demo.queue()
46
+ demo.launch()