Spaces:
Running
Running
Upload 2 files
Browse files- app.py +2 -2
- civitai_to_hf.py +5 -5
app.py
CHANGED
@@ -14,9 +14,9 @@ with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", fill_width=True, css=css, delete_ca
|
|
14 |
search_civitai_basemodel = gr.CheckboxGroup(label="Base model", choices=CIVITAI_BASEMODEL, value=[])
|
15 |
with gr.Row():
|
16 |
search_civitai_sort = gr.Radio(label="Sort", choices=CIVITAI_SORT, value=CIVITAI_SORT[0])
|
17 |
-
search_civitai_period = gr.Radio(label="Period", choices=CIVITAI_PERIOD, value=
|
18 |
with gr.Row():
|
19 |
-
search_civitai_query = gr.Textbox(label="Query", placeholder="
|
20 |
search_civitai_tag = gr.Textbox(label="Tag", lines=1)
|
21 |
search_civitai_submit = gr.Button("Search on Civitai")
|
22 |
with gr.Row():
|
|
|
14 |
search_civitai_basemodel = gr.CheckboxGroup(label="Base model", choices=CIVITAI_BASEMODEL, value=[])
|
15 |
with gr.Row():
|
16 |
search_civitai_sort = gr.Radio(label="Sort", choices=CIVITAI_SORT, value=CIVITAI_SORT[0])
|
17 |
+
search_civitai_period = gr.Radio(label="Period", choices=CIVITAI_PERIOD, value="Month")
|
18 |
with gr.Row():
|
19 |
+
search_civitai_query = gr.Textbox(label="Query", placeholder="flux", lines=1)
|
20 |
search_civitai_tag = gr.Textbox(label="Tag", lines=1)
|
21 |
search_civitai_submit = gr.Button("Search on Civitai")
|
22 |
with gr.Row():
|
civitai_to_hf.py
CHANGED
@@ -86,12 +86,12 @@ def search_on_civitai(query: str, types: list[str], allow_model: list[str] = [],
|
|
86 |
item = {}
|
87 |
if len(allow_model) != 0 and model['baseModel'] not in set(allow_model): continue
|
88 |
item['name'] = j['name']
|
89 |
-
item['creator'] = j['creator']['username']
|
90 |
-
item['tags'] = j['tags']
|
91 |
-
item['model_name'] = model['name']
|
92 |
-
item['base_model'] = model['baseModel']
|
93 |
item['dl_url'] = model['downloadUrl']
|
94 |
-
item['md'] = f'<img src="{model["images"][0]["url"]}" alt="thumbnail" width="150" height="240"><br>[
|
95 |
items.append(item)
|
96 |
return items
|
97 |
|
|
|
86 |
item = {}
|
87 |
if len(allow_model) != 0 and model['baseModel'] not in set(allow_model): continue
|
88 |
item['name'] = j['name']
|
89 |
+
item['creator'] = j['creator']['username'] if 'creator' in j.keys() and 'username' in j['creator'].keys() else ""
|
90 |
+
item['tags'] = j['tags'] if 'tags' in j.keys() else ""
|
91 |
+
item['model_name'] = model['name'] if 'name' in model.keys() else ""
|
92 |
+
item['base_model'] = model['baseModel'] if 'baseModel' in model.keys() else ""
|
93 |
item['dl_url'] = model['downloadUrl']
|
94 |
+
item['md'] = f'<img src="{model["images"][0]["url"]}" alt="thumbnail" width="150" height="240"><br>[Model URL](https://civitai.com/models/{j["id"]})'
|
95 |
items.append(item)
|
96 |
return items
|
97 |
|