-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
83 lines (37 loc) · 1.2 KB
/
app.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import gradio as gr
import os
logs = []
def downloader(url, output_path, civitai_token):
logs.clear()
prompt = f"civitai-downloader --url={url} --output_path={output_path} --token={civitai_token}"
os.system(prompt)
logs.append(f"Downloaded! Check the output path: {output_path}")
yield "\n".join(logs)
with gr.Blocks(title = "CivitAI Downloader") as app:
gr.Markdown("<h1> ⬇️ CivitAI Downloader ⬇️ </h1>")
with gr.Row():
link = gr.Textbox(
label = "URL",
placeholder = "Paste the URL here",
interactive = True,
)
out_path = gr.Textbox(
label = "Output Path",
placeholder = "Place the output path here",
interactive = True,
)
with gr.Row():
token = gr.Textbox(
label = "CivitAI API Key",
placeholder = "Paste the API Key here. Only needed the first time per session",
interactive = True,
)
with gr.Row():
button = gr.Button("Download!", variant = "primary")
with gr.Row():
outputs = gr.Textbox(
label = "Output information",
interactive = False,
)
button.click(downloader, [link, out_path, token], [outputs])
app.launch(share=True)