Spaces:
Paused
Paused
Upload 20 files
Browse files- .gitattributes +1 -0
- data/outputs/1763014490_821644639_0.png +3 -0
- data/user_config.json +3 -3
- webui.py +82 -81
.gitattributes
CHANGED
|
@@ -39,3 +39,4 @@ data/outputs/1762960674_1929733564_0.png filter=lfs diff=lfs merge=lfs -text
|
|
| 39 |
data/outputs/1762961285_1196835505_0.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
data/outputs/1762961897_1937961855_0.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
data/outputs/1762962578_40493155_0.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 39 |
data/outputs/1762961285_1196835505_0.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
data/outputs/1762961897_1937961855_0.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
data/outputs/1762962578_40493155_0.png filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
data/outputs/1763014490_821644639_0.png filter=lfs diff=lfs merge=lfs -text
|
data/outputs/1763014490_821644639_0.png
ADDED
|
Git LFS Details
|
data/user_config.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
-
"server_address": "https://
|
| 3 |
-
"model": "il/
|
| 4 |
"sampler": "euler",
|
| 5 |
"scheduler": "simple",
|
| 6 |
"steps": 30,
|
|
@@ -15,7 +15,7 @@
|
|
| 15 |
"negative_prefix": "",
|
| 16 |
"positive_prompt": "best quality,very aesthetic,highres,absurdres,sensitive,A girl dressed in a maid costume with a personality, kneeling in front of her master\uff0c",
|
| 17 |
"negative_prompt": "lowres,(bad),bad feet,text,error,fewer,extra,missing,worst quality,jpeg artifacts,low quality,watermark,unfinished,displeasing,oldest,early,chromatic aberration,signature,artistic error,username,scan,[abstract],english text,shiny_skin,",
|
| 18 |
-
"preset_name": "
|
| 19 |
"current_workflow": "workflow_template",
|
| 20 |
"language": "zh",
|
| 21 |
"config_save_interval": 20,
|
|
|
|
| 1 |
{
|
| 2 |
+
"server_address": "https://3h8a6zjd68-8188.cnb.run",
|
| 3 |
+
"model": "il/WAI_NSFW-illustrious-SDXL_v15.safetensors",
|
| 4 |
"sampler": "euler",
|
| 5 |
"scheduler": "simple",
|
| 6 |
"steps": 30,
|
|
|
|
| 15 |
"negative_prefix": "",
|
| 16 |
"positive_prompt": "best quality,very aesthetic,highres,absurdres,sensitive,A girl dressed in a maid costume with a personality, kneeling in front of her master\uff0c",
|
| 17 |
"negative_prompt": "lowres,(bad),bad feet,text,error,fewer,extra,missing,worst quality,jpeg artifacts,low quality,watermark,unfinished,displeasing,oldest,early,chromatic aberration,signature,artistic error,username,scan,[abstract],english text,shiny_skin,",
|
| 18 |
+
"preset_name": "\u2728 \u63a8\u8350\u98ce\u683c",
|
| 19 |
"current_workflow": "workflow_template",
|
| 20 |
"language": "zh",
|
| 21 |
"config_save_interval": 20,
|
webui.py
CHANGED
|
@@ -1204,57 +1204,58 @@ def create_ui():
|
|
| 1204 |
]
|
| 1205 |
api_save_cfg_btn.click(fn=save_api_settings, inputs=api_inputs, outputs=api_status)
|
| 1206 |
|
| 1207 |
-
|
| 1208 |
-
|
| 1209 |
-
|
| 1210 |
-
|
| 1211 |
-
|
| 1212 |
-
|
| 1213 |
-
|
| 1214 |
-
|
| 1215 |
-
|
| 1216 |
-
|
| 1217 |
-
|
| 1218 |
-
|
| 1219 |
-
|
| 1220 |
-
|
| 1221 |
-
|
| 1222 |
-
|
| 1223 |
-
|
| 1224 |
-
|
| 1225 |
-
|
| 1226 |
-
|
| 1227 |
-
|
| 1228 |
-
|
| 1229 |
-
|
| 1230 |
-
|
| 1231 |
-
|
| 1232 |
-
|
| 1233 |
-
|
| 1234 |
-
|
| 1235 |
-
|
| 1236 |
-
|
| 1237 |
-
|
| 1238 |
-
|
| 1239 |
-
|
| 1240 |
-
|
| 1241 |
-
|
| 1242 |
-
|
| 1243 |
-
|
| 1244 |
-
|
| 1245 |
-
|
| 1246 |
-
|
| 1247 |
-
|
| 1248 |
-
|
| 1249 |
-
|
| 1250 |
-
|
| 1251 |
-
|
| 1252 |
-
|
| 1253 |
-
|
| 1254 |
-
|
| 1255 |
-
|
| 1256 |
-
|
| 1257 |
-
|
|
|
|
| 1258 |
def save_preferences(lang, interval):
|
| 1259 |
queue_config_update(language=lang)
|
| 1260 |
seconds = set_config_save_interval(interval)
|
|
@@ -1262,36 +1263,36 @@ def create_ui():
|
|
| 1262 |
|
| 1263 |
save_prefs_btn.click(fn=save_preferences, inputs=[language_dropdown, autosave_interval], outputs=prefs_status)
|
| 1264 |
|
| 1265 |
-
|
| 1266 |
-
|
| 1267 |
-
|
| 1268 |
-
|
| 1269 |
-
|
| 1270 |
-
|
| 1271 |
-
|
| 1272 |
-
|
| 1273 |
-
|
| 1274 |
-
|
| 1275 |
-
|
| 1276 |
-
|
| 1277 |
-
|
| 1278 |
-
|
| 1279 |
-
|
| 1280 |
-
|
| 1281 |
-
|
| 1282 |
-
|
| 1283 |
-
|
| 1284 |
-
|
| 1285 |
-
|
| 1286 |
-
|
| 1287 |
-
|
| 1288 |
-
|
| 1289 |
-
|
| 1290 |
-
|
| 1291 |
-
|
| 1292 |
-
|
| 1293 |
-
|
| 1294 |
-
|
| 1295 |
if __name__ == "__main__":
|
| 1296 |
import argparse
|
| 1297 |
|
|
|
|
| 1204 |
]
|
| 1205 |
api_save_cfg_btn.click(fn=save_api_settings, inputs=api_inputs, outputs=api_status)
|
| 1206 |
|
| 1207 |
+
# Workflow management events
|
| 1208 |
+
def load_workflow_to_editor(workflow_name):
|
| 1209 |
+
"""Loads a workflow into the editor."""
|
| 1210 |
+
if not workflow_name or workflow_name == "workflow_template":
|
| 1211 |
+
workflow_path = os.path.join(WORKFLOWS_DIR, "workflow_template.json")
|
| 1212 |
+
else:
|
| 1213 |
+
workflow_path = os.path.join(WORKFLOWS_DIR, f"{workflow_name}.json")
|
| 1214 |
+
|
| 1215 |
+
if os.path.exists(workflow_path):
|
| 1216 |
+
try:
|
| 1217 |
+
with open(workflow_path, 'r', encoding='utf-8') as f:
|
| 1218 |
+
content = f.read()
|
| 1219 |
+
return workflow_name, content, f"Loaded workflow '{workflow_name}'"
|
| 1220 |
+
except Exception as e:
|
| 1221 |
+
return workflow_name, "", f"Error loading workflow: {e}"
|
| 1222 |
+
else:
|
| 1223 |
+
return workflow_name, "", f"Workflow '{workflow_name}' not found"
|
| 1224 |
+
|
| 1225 |
+
def save_workflow_from_editor(workflow_name, workflow_content):
|
| 1226 |
+
"""Saves workflow from editor."""
|
| 1227 |
+
success, message = save_workflow(workflow_name, workflow_content)
|
| 1228 |
+
if success:
|
| 1229 |
+
# Reload workflows
|
| 1230 |
+
global GLOBAL_WORKFLOWS
|
| 1231 |
+
GLOBAL_WORKFLOWS = load_workflows()
|
| 1232 |
+
return gr.update(choices=list(GLOBAL_WORKFLOWS.keys()), value=workflow_name), message
|
| 1233 |
+
else:
|
| 1234 |
+
return gr.update(), message
|
| 1235 |
+
|
| 1236 |
+
def delete_workflow_from_editor(workflow_name):
|
| 1237 |
+
"""Deletes a workflow."""
|
| 1238 |
+
success, message = delete_workflow(workflow_name)
|
| 1239 |
+
if success:
|
| 1240 |
+
# Reload workflows
|
| 1241 |
+
global GLOBAL_WORKFLOWS
|
| 1242 |
+
GLOBAL_WORKFLOWS = load_workflows()
|
| 1243 |
+
return (gr.update(choices=list(GLOBAL_WORKFLOWS.keys()), value="workflow_template"),
|
| 1244 |
+
"workflow_template", "", message)
|
| 1245 |
+
else:
|
| 1246 |
+
return gr.update(), workflow_name, "", message
|
| 1247 |
+
|
| 1248 |
+
def create_new_workflow():
|
| 1249 |
+
"""Creates a new empty workflow."""
|
| 1250 |
+
return "new_workflow", "", "New workflow created. Enter a name and JSON content."
|
| 1251 |
+
|
| 1252 |
+
# Wire up workflow management events
|
| 1253 |
+
load_workflow_btn.click(fn=load_workflow_to_editor, inputs=workflow_list, outputs=[workflow_name_input, workflow_content_input, workflow_status])
|
| 1254 |
+
save_workflow_btn.click(fn=save_workflow_from_editor, inputs=[workflow_name_input, workflow_content_input], outputs=[workflow_list, workflow_editor_status])
|
| 1255 |
+
delete_workflow_btn.click(fn=delete_workflow_from_editor, inputs=workflow_name_input, outputs=[workflow_list, workflow_name_input, workflow_content_input, workflow_editor_status])
|
| 1256 |
+
new_workflow_btn.click(fn=create_new_workflow, outputs=[workflow_name_input, workflow_content_input, workflow_editor_status])
|
| 1257 |
+
|
| 1258 |
+
# Preferences events
|
| 1259 |
def save_preferences(lang, interval):
|
| 1260 |
queue_config_update(language=lang)
|
| 1261 |
seconds = set_config_save_interval(interval)
|
|
|
|
| 1263 |
|
| 1264 |
save_prefs_btn.click(fn=save_preferences, inputs=[language_dropdown, autosave_interval], outputs=prefs_status)
|
| 1265 |
|
| 1266 |
+
# --- App Load and Polling Events ---
|
| 1267 |
+
|
| 1268 |
+
# This function will be polled to update dynamic UI elements
|
| 1269 |
+
def poll_updates():
|
| 1270 |
+
history = get_history_images()
|
| 1271 |
+
status_text, image_list = get_scheduler_status_for_ui()
|
| 1272 |
+
return history, status_text, image_list
|
| 1273 |
+
|
| 1274 |
+
# Load user config on page load (runs once)
|
| 1275 |
+
app.load(fn=load_ui_config, outputs=[
|
| 1276 |
+
server_addr, model, sampler, scheduler, steps, cfg, width, height,
|
| 1277 |
+
batch_size, batch_count, seed, after_generate, positive_prefix_input,
|
| 1278 |
+
negative_prefix_input, positive_prompt, negative_prompt, preset_selector, workflow_selector,
|
| 1279 |
+
model, sampler, scheduler, workflow_selector,
|
| 1280 |
+
# API settings
|
| 1281 |
+
api_return, api_n, api_server_addr, api_model, api_sampler, api_scheduler,
|
| 1282 |
+
api_steps, api_cfg, api_width, api_height, api_seed, api_after,
|
| 1283 |
+
api_pos_prefix, api_neg_prefix, api_workflow
|
| 1284 |
+
])
|
| 1285 |
+
|
| 1286 |
+
# Poll for history and scheduler status updates every 5 seconds
|
| 1287 |
+
# Use a backward-compatible method for creating a timer
|
| 1288 |
+
if hasattr(gr, 'Timer'):
|
| 1289 |
+
# New way for Gradio 4.x and later
|
| 1290 |
+
timer = gr.Timer(5)
|
| 1291 |
+
timer.tick(fn=poll_updates, outputs=[history_gallery, scheduler_status, scheduler_output])
|
| 1292 |
+
else:
|
| 1293 |
+
# Old way for Gradio 3.x
|
| 1294 |
+
app.load(fn=poll_updates, outputs=[history_gallery, scheduler_status, scheduler_output], every=5)
|
| 1295 |
+
return app
|
| 1296 |
if __name__ == "__main__":
|
| 1297 |
import argparse
|
| 1298 |
|