Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyongliang committed Mar 13, 2023
1 parent 67e6928 commit 7faf90a
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 7 deletions.
6 changes: 5 additions & 1 deletion javascript/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ function restart_reload(){
function login(username) {
var user=gradioApp().querySelector('#tabs').querySelectorAll('button')[5];

if(username=='admin')
if(username=='admin'){
user.style.display='block'
user.click()
}
else
user.style.display='none'
}
23 changes: 22 additions & 1 deletion localizations/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,6 @@
"A value that determines the output of random number generator - if you create an image with same parameters and seed as another image, you'll get the same result": "一个固定随机数生成器输出的值 - 以相同参数和随机种子生成的图像会得到相同的结果\n\ud83c\udfb2 将随机种子设置为-1,则每次都会使用一个新的随机数\n\u267b\ufe0f 重用上一次使用的随机种子,如果想要固定输出结果就会很有用",


"----deprecated----": "----以下内容在webui新版本已移除----",
"▼": "",
"History": "历史记录",
"Show Textbox": "显示文本框",
Expand Down Expand Up @@ -779,6 +778,28 @@
"Hide annotator result": "隐藏标注结果",
"Current user :": "当前用户 : ",
"Reloading...": "重新载入...",
"SaegMaker endpoint": "SageMaker 终端节点",
"Ignore selected VAE for stable diffusion checkpoints that have their own .vae.pt next to them": "对那些已经有.vae.pt的 stable diffusion 模型忽略已选择的 VAE",
"Directory for temporary images; leave empty for default": "临时图片的目录,留空使用默认",
"Cleanup non-default temporary directory when starting webui": "启动webui时清空非默认的临时目录",
"Turn on pin_memory for DataLoader. Makes training slightly faster but can increase memory usage.": "为数据加载器打开 pin_memory, 这将使得训练速度更快一些但会使用更多内存",
"Saves Optimizer state as separate *.optim file. Training can be resumed with HN itself and matching optim file.": "保存优化器状态为单独的 *.optim,训练可以通过 HN 恢复并匹配 optim 文件",
"Show image creation progress every N sampling steps. Set to 0 to disable. Set to -1 to show after completion of batch.": "每N个采样步数后显示图片创建进程,设置为0禁用,设置为1在batch完成后显示 ",
"Config file for Control Net models": "ControlNet 模型配置文件",
"Config file for Adapter models": "Adapter 模型配置文件",
"Directory for detected maps auto saving": "已检测的detectmap自动保存的目录",
"Extra path to scan for ControlNet models (e.g. training output directory)": "扫描 ControlNet 模型的额外路径,例如训练输出路径",
"Multi ControlNet: Max models amount (requires restart)": "多个 ControlNet: 最大模型数据(需要重启)",
"Model cache size (requires restart)": "模型缓存大小(需要重启)",
"Apply transfer control when loading models": "加载模型时应用转移控制",
"Do not append detectmap to output": "不追加 detectmap 到输出",
"Allow detectmap auto saving": "允许 detectmap 自动保存",
"Use mid-control on highres pass (second pass)": "在 highres pass(second pass)时使用mid-control",
"Allow other script to control this extension": "允许其他脚本控制这个插件",
"Skip img2img processing when using img2img initial image": "在使用图生图初始图片时忽略图生图处理",
"Enable optimized monocular depth estimation": "允许优化单目深度估计",
"Only use mid-control when inference": "推理时仅使用 mid-control",
"Enable CFG-Based guidance": "使用基于扩散度指引",

"--------": "--------"
}
22 changes: 22 additions & 0 deletions localizations/zh_TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,28 @@
"Hide annotator result": "隱藏標註結果",
"Current user": "當前用戶 : ",
"Reloading...": "重新載入...",
"SaegMaker endpoint": "SageMaker 終端節點",
"Ignore selected VAE for stable diffusion checkpoints that have their own .vae.pt next to them": "對那些已經有.vae.pt的 stable diffusion 模型忽略已選擇的 VAE",
"Directory for temporary images; leave empty for default": "臨時圖片的目錄,留空使用默認",
"Cleanup non-default temporary directory when starting webui": "啟動webui時清空非默認的臨時目錄",
"Turn on pin_memory for DataLoader. Makes training slightly faster but can increase memory usage.": "為數據加載器打開 pin_memory, 這將使得訓練速度更快一些但會使用更多內存",
"Saves Optimizer state as separate *.optim file. Training can be resumed with HN itself and matching optim file.": "保存優化器狀態為單獨的 *.optim,訓練可以通過 HN 恢復並匹配 optim 文件",
"Show image creation progress every N sampling steps. Set to 0 to disable. Set to -1 to show after completion of batch.": "每N個採樣步數後顯示圖片創建進程,設置為0禁用,設置為1在batch完成後顯示 ",
"Config file for Control Net models": "ControlNet 模型配置文件",
"Config file for Adapter models": "Adapter 模型配置文件",
"Directory for detected maps auto saving": "已檢測的detectmap自動保存的目錄",
"Extra path to scan for ControlNet models (e.g. training output directory)": "掃描 ControlNet 模型的額外路徑,例如訓練輸出路徑",
"Multi ControlNet: Max models amount (requires restart)": "多個 ControlNet: 最大模型數據(需要重啟)",
"Model cache size (requires restart)": "模型緩存大小(需要重啟)",
"Apply transfer control when loading models": "加載模型時應用轉移控制",
"Do not append detectmap to output": "不追加 detectmap 到輸出",
"Allow detectmap auto saving": "允許 detectmap 自動保存",
"Use mid-control on highres pass (second pass)": "在 highres pass(second pass)時使用mid-control",
"Allow other script to control this extension": "允許其他腳本控制這個插件",
"Skip img2img processing when using img2img initial image": "在使用圖生圖初始圖片時忽略圖生圖處理",
"Enable optimized monocular depth estimation": "允許優化單目深度估計",
"Only use mid-control when inference": "推理時僅使用 mid-control",
"Enable CFG-Based guidance": "使用基於擴散度指引",

"--------": "--------"
}
13 changes: 8 additions & 5 deletions modules/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,11 +613,11 @@ def open_folder(f):
with gr.Column():
with gr.Row():
if tabname != "extras":
save = gr.Button('Save', elem_id=f'save_{tabname}')
save = gr.Button('Save', elem_id=f'save_{tabname}', visible=False)

buttons = parameters_copypaste.create_buttons(["img2img", "inpaint", "extras"])
button_id = "hidden_element" if shared.cmd_opts.hide_ui_dir_config else 'open_folder'
open_folder_button = gr.Button(folder_symbol, elem_id=button_id)
open_folder_button = gr.Button(folder_symbol, elem_id=button_id, visible=False)

open_folder_button.click(
fn=lambda: open_folder(opts.outdir_samples or outdir),
Expand All @@ -627,7 +627,7 @@ def open_folder(f):

if tabname != "extras":
with gr.Row():
do_make_zip = gr.Checkbox(label="Make Zip when Save?", value=False)
do_make_zip = gr.Checkbox(label="Make Zip when Save?", value=False, visible=False)

with gr.Row():
download_files = gr.File(None, file_count="multiple", interactive=False, show_label=False, visible=False)
Expand Down Expand Up @@ -672,9 +672,11 @@ def open_folder(f):
extras_submit = None

def update_sagemaker_endpoint():
print(shared.opts.sagemaker_endpoint)
return gr.update(value=shared.opts.sagemaker_endpoint, choices=shared.sagemaker_endpoints)

def update_sd_model_checkpoint():
print(shared.opts.sd_model_checkpoint)
return gr.update(value=shared.opts.sd_model_checkpoint, choices=modules.sd_models.checkpoint_tiles())

def update_username():
Expand All @@ -688,10 +690,11 @@ def update_username():
items = []
for item in json.loads(response.text):
items.append([item['username'], item['password'], item['options'] if 'options' in item else ''])
print(items)
return gr.update(value=shared.username), gr.update(value=items)
else:
return gr.update(value=shared.username), gr.update()
else:
return gr.update(value=shared.username), gr.update()

def create_ui():
import modules.img2img
Expand Down Expand Up @@ -2092,7 +2095,7 @@ def save_userdata(user_dataframe, request: gr.Request):
component_dict[k] = component

with gr.Row():
with gr.Column(scale=4):
with gr.Column(scale=5):
gr.HTML(value='<h1 align="right">Current user : </h1>')
with gr.Column(scale=1):
username_state = gr.HTML()
Expand Down

0 comments on commit 7faf90a

Please sign in to comment.