Ryouko65777 commited on
Commit
2f5ee80
·
verified ·
1 Parent(s): b6c8013

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -6
app.py CHANGED
@@ -1,10 +1,44 @@
1
  import gradio as gr
2
- from civitai_downloader import download_file
3
 
 
4
 
5
- with gr.Blocks() as demo:
6
- gr.Markdown("# IN PROGRESS")
 
 
 
 
7
 
8
-
9
- demo.launch()
10
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import os
3
 
4
+ logs = []
5
 
6
+ def downloader(url, output_path, civitai_token):
7
+ logs.clear()
8
+ prompt = f"civitai-downloader --url={url} --output_path={output_path} --token={civitai_token}"
9
+ os.system(prompt)
10
+ logs.append(f"Downloaded! Check the output path: {output_path}")
11
+ yield "\n".join(logs)
12
 
13
+ with gr.Blocks(title = "CivitAI Downloader") as app:
14
+ gr.Markdown("<h1> ⬇️ CivitAI Downloader ⬇️ </h1>")
15
+ gr.Markdown(f" gradio demo by [Eddycrack864](https://github.com/Eddycrack864)")
16
+ with gr.Row():
17
+ link = gr.Textbox(
18
+ label = "URL",
19
+ placeholder = "Paste the URL here",
20
+ interactive = True,
21
+ )
22
+ out_path = gr.Textbox(
23
+ label = "Output Path",
24
+ placeholder = "Place the output path here",
25
+ interactive = False,
26
+ value = ""
27
+ )
28
+ with gr.Row():
29
+ token = gr.Textbox(
30
+ label = "CivitAI API Key",
31
+ placeholder = "Paste the API Key here. Only needed the first time per session",
32
+ interactive = True,
33
+ )
34
+ with gr.Row():
35
+ button = gr.Button("Download!", variant = "primary")
36
+ with gr.Row():
37
+ outputs = gr.Textbox(
38
+ label = "Output information",
39
+ interactive = False,
40
+ )
41
+
42
+ button.click(downloader, [link, out_path, token], [outputs])
43
+
44
+ app.launch(share=True)