minor: header
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from civitai_constants import (TYPE, BASEMODEL, SORT, PERIOD, FILETYPE)
|
|
| 6 |
import time
|
| 7 |
|
| 8 |
css = """
|
| 9 |
-
.title { font-size: 3em; align-items: center; text-align: center; }
|
| 10 |
.info { align-items: center; text-align: center; }
|
| 11 |
.desc [src$='#float'] { float: right; margin: 20px; }
|
| 12 |
#modal-window{ position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-height: inherit; }
|
|
@@ -110,10 +110,19 @@ By continuing on to the tool, you are assumed to have **acknowledged, understood
|
|
| 110 |
|
| 111 |
### For those with common sense, please continue.
|
| 112 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
|
|
|
| 114 |
|
| 115 |
with gr.Blocks(fill_width=True, css=css, delete_cache=(3600, 3600)) as demo:
|
| 116 |
-
gr.Markdown(
|
| 117 |
|
| 118 |
state = gr.State(value={})
|
| 119 |
|
|
@@ -121,7 +130,7 @@ with gr.Blocks(fill_width=True, css=css, delete_cache=(3600, 3600)) as demo:
|
|
| 121 |
api_keys_state = gr.BrowserState(["", ""], storage_key="civitai2hf_api_keys")
|
| 122 |
|
| 123 |
with gr.Row():
|
| 124 |
-
show_btn = gr.Button("Show Modal")
|
| 125 |
with gr.Tabs() as tabs:
|
| 126 |
with gr.TabItem("Search & Download"):
|
| 127 |
with gr.Row():
|
|
@@ -144,10 +153,10 @@ with gr.Blocks(fill_width=True, css=css, delete_cache=(3600, 3600)) as demo:
|
|
| 144 |
with gr.Group():
|
| 145 |
gr.Markdown("## 3️⃣ Search Query", container=True)
|
| 146 |
with gr.Row():
|
| 147 |
-
search_civitai_query = gr.Textbox(label="Query", placeholder="
|
| 148 |
search_civitai_tag = gr.Dropdown(label="Tag", choices=get_civitai_tag(), value=get_civitai_tag()[0], allow_custom_value=True)
|
| 149 |
search_civitai_user = gr.Textbox(label="Username", lines=1)
|
| 150 |
-
search_civitai_submit = gr.Button("Search
|
| 151 |
|
| 152 |
with gr.Group():
|
| 153 |
gr.Markdown("## 4️⃣ Select Models to Backup from Search Results", container=True)
|
|
@@ -156,7 +165,7 @@ with gr.Blocks(fill_width=True, css=css, delete_cache=(3600, 3600)) as demo:
|
|
| 156 |
search_civitai_json = gr.JSON(value={}, visible=False)
|
| 157 |
with gr.Row(equal_height=True):
|
| 158 |
with gr.Column(scale=9):
|
| 159 |
-
with gr.Accordion("Gallery View ⚠️ Surprise NSFW + RAM Warning ⚠️", open=False):
|
| 160 |
search_civitai_gallery = gr.Gallery(
|
| 161 |
[],
|
| 162 |
label="Select from Results",
|
|
@@ -169,7 +178,7 @@ with gr.Blocks(fill_width=True, css=css, delete_cache=(3600, 3600)) as demo:
|
|
| 169 |
preview=False,
|
| 170 |
height="auto"
|
| 171 |
)
|
| 172 |
-
with gr.Accordion("List View", open=False):
|
| 173 |
search_civitai_result_checkbox = gr.CheckboxGroup(label="", choices=[], value=[])
|
| 174 |
search_civitai_result = gr.Dropdown(label="Selected Models from Search", choices=[("", "")], value=[],
|
| 175 |
allow_custom_value=True, visible=True, multiselect=True)
|
|
@@ -241,7 +250,9 @@ with gr.Blocks(fill_width=True, css=css, delete_cache=(3600, 3600)) as demo:
|
|
| 241 |
except Exception as e:
|
| 242 |
print(f"Error saving API keys: {e}")
|
| 243 |
return ["", ""], gr.Markdown("Error saving API keys", visible=True)
|
| 244 |
-
|
|
|
|
|
|
|
| 245 |
with Modal(visible=True, elem_id="modal-window") as modal:
|
| 246 |
gr.Markdown(common_sense)
|
| 247 |
gr.on(
|
|
|
|
| 6 |
import time
|
| 7 |
|
| 8 |
css = """
|
| 9 |
+
.title { padding: 30px 00px; font-size: 3em; align-items: center; text-align: center; }
|
| 10 |
.info { align-items: center; text-align: center; }
|
| 11 |
.desc [src$='#float'] { float: right; margin: 20px; }
|
| 12 |
#modal-window{ position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-height: inherit; }
|
|
|
|
| 110 |
|
| 111 |
### For those with common sense, please continue.
|
| 112 |
"""
|
| 113 |
+
header_md = """
|
| 114 |
+
# 🚨 Civitai Models & Workflow Conservation / Archiving Tool
|
| 115 |
+
### WIP: Expect changes and adjustments. Planned: S3 buckets, B2 storage, IPFS, magnet tools for torrents.
|
| 116 |
+
---
|
| 117 |
+
* Provided by [AI Without Borders](https://huggingface.co/spaces/aiwithoutborders-xyz). Run locally or on Huggingface Spaces.
|
| 118 |
+
* This tool is ideal for creators with many LORAs. One-click backup your entire portfolio.
|
| 119 |
+
* Keys are always stored locally on your browser. PRs welcome and appreciated.
|
| 120 |
+
* Usage: easy as 1️⃣->2️⃣->3️⃣, just follow the step numbers.
|
| 121 |
|
| 122 |
+
"""
|
| 123 |
|
| 124 |
with gr.Blocks(fill_width=True, css=css, delete_cache=(3600, 3600)) as demo:
|
| 125 |
+
gr.Markdown(header_md, elem_classes="title")
|
| 126 |
|
| 127 |
state = gr.State(value={})
|
| 128 |
|
|
|
|
| 130 |
api_keys_state = gr.BrowserState(["", ""], storage_key="civitai2hf_api_keys")
|
| 131 |
|
| 132 |
with gr.Row():
|
| 133 |
+
show_btn = gr.Button("Show Modal", visible=False)
|
| 134 |
with gr.Tabs() as tabs:
|
| 135 |
with gr.TabItem("Search & Download"):
|
| 136 |
with gr.Row():
|
|
|
|
| 153 |
with gr.Group():
|
| 154 |
gr.Markdown("## 3️⃣ Search Query", container=True)
|
| 155 |
with gr.Row():
|
| 156 |
+
search_civitai_query = gr.Textbox(label="Query", placeholder="wan", lines=1)
|
| 157 |
search_civitai_tag = gr.Dropdown(label="Tag", choices=get_civitai_tag(), value=get_civitai_tag()[0], allow_custom_value=True)
|
| 158 |
search_civitai_user = gr.Textbox(label="Username", lines=1)
|
| 159 |
+
search_civitai_submit = gr.Button("Search Civitai API", variant="primary")
|
| 160 |
|
| 161 |
with gr.Group():
|
| 162 |
gr.Markdown("## 4️⃣ Select Models to Backup from Search Results", container=True)
|
|
|
|
| 165 |
search_civitai_json = gr.JSON(value={}, visible=False)
|
| 166 |
with gr.Row(equal_height=True):
|
| 167 |
with gr.Column(scale=9):
|
| 168 |
+
with gr.Accordion("👇 Gallery View ⚠️ Surprise NSFW + RAM Warning ⚠️", open=False):
|
| 169 |
search_civitai_gallery = gr.Gallery(
|
| 170 |
[],
|
| 171 |
label="Select from Results",
|
|
|
|
| 178 |
preview=False,
|
| 179 |
height="auto"
|
| 180 |
)
|
| 181 |
+
with gr.Accordion("👇 List View", open=False):
|
| 182 |
search_civitai_result_checkbox = gr.CheckboxGroup(label="", choices=[], value=[])
|
| 183 |
search_civitai_result = gr.Dropdown(label="Selected Models from Search", choices=[("", "")], value=[],
|
| 184 |
allow_custom_value=True, visible=True, multiselect=True)
|
|
|
|
| 250 |
except Exception as e:
|
| 251 |
print(f"Error saving API keys: {e}")
|
| 252 |
return ["", ""], gr.Markdown("Error saving API keys", visible=True)
|
| 253 |
+
with gr.TabItem("Known Issues"):
|
| 254 |
+
with gr.Column():
|
| 255 |
+
gr.Markdown("* Local browser key storage logic sometimes fails.\n* JSON Metadata for models fail to import.\n* WAN models seem to have a mind of its own. For the time being, it's recommended when searching for WAN models to UNCHECK `Wan Video` from filter and either use model tags or query directly.")
|
| 256 |
with Modal(visible=True, elem_id="modal-window") as modal:
|
| 257 |
gr.Markdown(common_sense)
|
| 258 |
gr.on(
|