Skip to content

Commit 31db25e

Browse files
author
Bruno Seoane
committed
2 parents 952ff32 + 458cca0 commit 31db25e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2707
-972
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ notification.mp3
2929
/textual_inversion
3030
.vscode
3131
/extensions
32+
/test/stdout.txt
33+
/test/stderr.txt

CODEOWNERS

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
11
* @AUTOMATIC1111
2+
/localizations/ar_AR.json @xmodar @blackneoo
3+
/localizations/de_DE.json @LunixWasTaken
4+
/localizations/es_ES.json @innovaciones
5+
/localizations/fr_FR.json @tumbly
6+
/localizations/it_IT.json @EugenioBuffo
7+
/localizations/ja_JP.json @yuuki76
8+
/localizations/ko_KR.json @36DB
9+
/localizations/pt_BR.json @M-art-ucci
10+
/localizations/ru_RU.json @kabachuha
11+
/localizations/tr_TR.json @camenduru
12+
/localizations/zh_CN.json @dtlnor @bgluminous
13+
/localizations/zh_TW.json @benlisquare

javascript/extensions.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
function extensions_apply(_, _){
3+
disable = []
4+
update = []
5+
gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x){
6+
if(x.name.startsWith("enable_") && ! x.checked)
7+
disable.push(x.name.substr(7))
8+
9+
if(x.name.startsWith("update_") && x.checked)
10+
update.push(x.name.substr(7))
11+
})
12+
13+
restart_reload()
14+
15+
return [JSON.stringify(disable), JSON.stringify(update)]
16+
}
17+
18+
function extensions_check(){
19+
gradioApp().querySelectorAll('#extensions .extension_status').forEach(function(x){
20+
x.innerHTML = "Loading..."
21+
})
22+
23+
return []
24+
}
25+
26+
function install_extension_from_index(button, url){
27+
button.disabled = "disabled"
28+
button.value = "Installing..."
29+
30+
textarea = gradioApp().querySelector('#extension_to_install textarea')
31+
textarea.value = url
32+
textarea.dispatchEvent(new Event("input", { bubbles: true }))
33+
34+
gradioApp().querySelector('#install_extension_button').click()
35+
}

launch.py

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import platform
88

99
dir_repos = "repositories"
10+
dir_extensions = "extensions"
1011
python = sys.executable
1112
git = os.environ.get('GIT', "git")
1213
index_url = os.environ.get('INDEX_URL', "")
@@ -16,11 +17,11 @@ def extract_arg(args, name):
1617
return [x for x in args if x != name], name in args
1718

1819

19-
def run(command, desc=None, errdesc=None):
20+
def run(command, desc=None, errdesc=None, custom_env=None):
2021
if desc is not None:
2122
print(desc)
2223

23-
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
24+
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, env=os.environ if custom_env is None else custom_env)
2425

2526
if result.returncode != 0:
2627

@@ -101,9 +102,27 @@ def version_check(commit):
101102
else:
102103
print("Not a git clone, can't perform version check.")
103104
except Exception as e:
104-
print("versipm check failed",e)
105+
print("version check failed", e)
106+
107+
108+
def run_extensions_installers():
109+
if not os.path.isdir(dir_extensions):
110+
return
111+
112+
for dirname_extension in os.listdir(dir_extensions):
113+
path_installer = os.path.join(dir_extensions, dirname_extension, "install.py")
114+
if not os.path.isfile(path_installer):
115+
continue
116+
117+
try:
118+
env = os.environ.copy()
119+
env['PYTHONPATH'] = os.path.abspath(".")
120+
121+
print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {dirname_extension}", custom_env=env))
122+
except Exception as e:
123+
print(e, file=sys.stderr)
124+
105125

106-
107126
def prepare_enviroment():
108127
torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113")
109128
requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")
@@ -128,10 +147,12 @@ def prepare_enviroment():
128147
blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")
129148

130149
sys.argv += shlex.split(commandline_args)
150+
test_argv = [x for x in sys.argv if x != '--tests']
131151

132152
sys.argv, skip_torch_cuda_test = extract_arg(sys.argv, '--skip-torch-cuda-test')
133153
sys.argv, reinstall_xformers = extract_arg(sys.argv, '--reinstall-xformers')
134154
sys.argv, update_check = extract_arg(sys.argv, '--update-check')
155+
sys.argv, run_tests = extract_arg(sys.argv, '--tests')
135156
xformers = '--xformers' in sys.argv
136157
deepdanbooru = '--deepdanbooru' in sys.argv
137158
ngrok = '--ngrok' in sys.argv
@@ -187,13 +208,35 @@ def prepare_enviroment():
187208

188209
run_pip(f"install -r {requirements_file}", "requirements for Web UI")
189210

211+
run_extensions_installers()
212+
190213
if update_check:
191214
version_check(commit)
192215

193216
if "--exit" in sys.argv:
194217
print("Exiting because of --exit argument")
195218
exit(0)
196219

220+
if run_tests:
221+
tests(test_argv)
222+
exit(0)
223+
224+
225+
def tests(argv):
226+
if "--api" not in argv:
227+
argv.append("--api")
228+
229+
print(f"Launching Web UI in another process for testing with arguments: {' '.join(argv[1:])}")
230+
231+
with open('test/stdout.txt', "w", encoding="utf8") as stdout, open('test/stderr.txt', "w", encoding="utf8") as stderr:
232+
proc = subprocess.Popen([sys.executable, *argv], stdout=stdout, stderr=stderr)
233+
234+
import test.server_poll
235+
test.server_poll.run_tests()
236+
237+
print(f"Stopping Web UI process with id {proc.pid}")
238+
proc.kill()
239+
197240

198241
def start_webui():
199242
print(f"Launching Web UI with arguments: {' '.join(sys.argv[1:])}")

localizations/ar_AR.json

Lines changed: 98 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,21 @@
2626
"Sampling Steps": "عدد الخطوات",
2727
"Sampling method": "أسلوب الخطو",
2828
"Which algorithm to use to produce the image": "Sampler: اسم نظام تحديد طريقة تغيير المسافات بين الخطوات",
29+
"Euler a": "Euler a",
2930
"Euler Ancestral - very creative, each can get a completely different picture depending on step count, setting steps to higher than 30-40 does not help": "Euler Ancestral: طريقة مبدعة يمكن أن تنتج صور مختلفة على حسب عدد الخطوات، لا تتغير بعد 30-40 خطوة",
31+
"Euler": "Euler",
32+
"LMS": "LMS",
33+
"Heun": "Heun",
34+
"DPM2": "DPM2",
35+
"DPM2 a": "DPM2 a",
36+
"DPM fast": "DPM fast",
37+
"DPM adaptive": "DPM adaptive",
38+
"LMS Karras": "LMS Karras",
39+
"DPM2 Karras": "DPM2 Karras",
40+
"DPM2 a Karras": "DPM2 a Karras",
41+
"DDIM": "DDIM",
3042
"Denoising Diffusion Implicit Models - best at inpainting": "Denoising Diffusion Implicit Models: الأفضل في الإنتاج الجزئي",
43+
"PLMS": "PLMS",
3144
"Width": "العرض",
3245
"Height": "الإرتفاع",
3346
"Restore faces": "تحسين الوجوه",
@@ -58,6 +71,7 @@
5871
"Resize seed from height": "إرتفاع الممزوج",
5972
"Make an attempt to produce a picture similar to what would have been produced with same seed at specified resolution": "Seed resize from: حدد دقة صورة الممزوج (0: نفس دقة الإنتاج)",
6073
"Open for Clip Aesthetic!": "تضمين تجميلي",
74+
"▼": "",
6175
"Aesthetic weight": "أثر التضمين",
6276
"Aesthetic steps": "عدد الخطوات",
6377
"Aesthetic learning rate": "معدل التعلم",
@@ -79,7 +93,6 @@
7993
"-": "-",
8094
"or": "أو",
8195
"Click to Upload": "انقر للرفع",
82-
"Prompts": "قائمة الطلبات",
8396
"X/Y plot": "مصفوفة عوامل",
8497
"X type": "العامل الأول",
8598
"Nothing": "لا شيء",
@@ -92,13 +105,16 @@
92105
"Checkpoint name": "ملف الأوزان",
93106
"Hypernetwork": "الشبكة الفائقة",
94107
"Hypernet str.": "قوة الشبكة الفائقة",
108+
"Inpainting conditioning mask strength": "قوة قناع الإنتاج الجزئي",
109+
"Only applies to inpainting models. Determines how strongly to mask off the original image for inpainting and img2img. 1.0 means fully masked, which is the default behaviour. 0.0 means a fully unmasked conditioning. Lower values will help preserve the overall composition of the image, but will struggle with large changes.": "حدد مدى صرامة قناع الإنتاج، يصبح القناع شفاف إذا قوته 0 (لا يعمل إلا مع ملفات أوزان الإنتاج الجزئي: inpainting)",
95110
"Sigma Churn": "العشوائية (Schurn)",
96111
"Sigma min": "أدنى تشويش (Stmin)",
97112
"Sigma max": "أقصى تشويش (Stmax)",
98113
"Sigma noise": "التشويش (Snoise)",
99114
"Eta": "العامل Eta η",
100115
"Clip skip": "تخطي آخر طبقات CLIP",
101116
"Denoising": "المدى",
117+
"Cond. Image Mask Weight": "قوة قناع الإنتاج الجزئي",
102118
"X values": "قيم العامل الأول",
103119
"Separate values for X axis using commas.": "افصل القيم بفواصل (,) من اليسار إلى اليمين",
104120
"Y type": "العامل الثاني",
@@ -168,6 +184,12 @@
168184
"Tile overlap": "تداخل النافذة",
169185
"For SD upscale, how much overlap in pixels should there be between tiles. Tiles overlap so that when they are merged back into one picture, there is no clearly visible seam.": "المكبر ينظر إلى أجزاء الصورة من خلال نافذة لتكبير المحتوى ثم ينتقل إلى الجزء المجاور، يفضل أن يكون هناك تداخل بين كل رقعة لكي لا يكون هناك اختلاف واضح بينهم",
170186
"Upscaler": "طريقة التكبير",
187+
"Lanczos": "Lanczos",
188+
"LDSR": "LDSR",
189+
"ScuNET GAN": "ScuNET GAN",
190+
"ScuNET PSNR": "ScuNET PSNR",
191+
"ESRGAN_4x": "ESRGAN_4x",
192+
"SwinIR 4x": "SwinIR 4x",
171193
"Inpaint": "إنتاج جزئي",
172194
"Draw mask": "ارسم القناع",
173195
"Upload mask": "ارفع القناع",
@@ -192,14 +214,14 @@
192214
"GFPGAN visibility": "أثر GFPGAN (محسن وجوه)",
193215
"CodeFormer visibility": "أثر CodeFormer (محسن وجوه)",
194216
"CodeFormer weight (0 = maximum effect, 1 = minimum effect)": "وزن CodeFormer (يزيد التفاصيل على حساب الجودة)",
217+
"Upscale Before Restoring Faces": "كبر قبل تحسين الوجوه",
195218
"Scale to": "دقة محددة",
196219
"Crop to fit": "قص الأطراف الزائدة إذا لم تتناسب الأبعاد",
197220
"Batch Process": "حزمة صور",
198221
"Batch from Directory": "حزمة من مجلد",
199222
"A directory on the same machine where the server is running.": "مسار مجلد صور موجود في جهاز الخادم",
200223
"Leave blank to save images to the default path.": "اتركه فارغا لاستخدام المسار الإفتراضي",
201224
"Show result images": "اعرض الصور الناتجة",
202-
"Open output directory": "افتح مجلد المخرجات",
203225
"PNG Info": "عوامل الصورة",
204226
"Send to txt2img": "أرسل لنص إلى صورة",
205227
"Checkpoint Merger": "مزج الأوزان",
@@ -232,7 +254,41 @@
232254
"Enter hypernetwork layer structure": "ترتيب مضاعفات عرض الطبقات",
233255
"1st and last digit must be 1. ex:'1, 2, 1'": "المضاعفين الأول والأخير يجب أن يكونا 1، مثال: 1, 2, 1",
234256
"Select activation function of hypernetwork": "دالة التنشيط",
257+
"linear": "linear",
258+
"relu": "relu",
259+
"leakyrelu": "leakyrelu",
260+
"elu": "elu",
261+
"swish": "swish",
262+
"tanh": "tanh",
263+
"sigmoid": "sigmoid",
264+
"celu": "celu",
265+
"gelu": "gelu",
266+
"glu": "glu",
267+
"hardshrink": "hardshrink",
268+
"hardsigmoid": "hardsigmoid",
269+
"hardtanh": "hardtanh",
270+
"logsigmoid": "logsigmoid",
271+
"logsoftmax": "logsoftmax",
272+
"mish": "mish",
273+
"prelu": "prelu",
274+
"rrelu": "rrelu",
275+
"relu6": "relu6",
276+
"selu": "selu",
277+
"silu": "silu",
278+
"softmax": "softmax",
279+
"softmax2d": "softmax2d",
280+
"softmin": "softmin",
281+
"softplus": "softplus",
282+
"softshrink": "softshrink",
283+
"softsign": "softsign",
284+
"tanhshrink": "tanhshrink",
285+
"threshold": "threshold",
235286
"Select Layer weights initialization. relu-like - Kaiming, sigmoid-like - Xavier is recommended": "تهيئة الأوزان (استخدم Kaiming مع relu وأمثالها وXavier مع sigmoid وأمثالها)",
287+
"Normal": "Normal",
288+
"KaimingUniform": "KaimingUniform",
289+
"KaimingNormal": "KaimingNormal",
290+
"XavierUniform": "XavierUniform",
291+
"XavierNormal": "XavierNormal",
236292
"Add layer normalization": "أضف تسوية الطبقات (LayerNorm)",
237293
"Use dropout": "استخدم الإسقاط (Dropout)",
238294
"Overwrite Old Hypernetwork": "استبدل الشبكة الفائقة القديمة",
@@ -393,13 +449,26 @@
393449
"Add model hash to generation information": "أضف رمز تهشير (Hash) ملف الأوزان لعوامل الإنتاج",
394450
"Add model name to generation information": "أضف اسم ملف الأوزان لعوامل الإنتاج",
395451
"When reading generation parameters from text into UI (from PNG info or pasted text), do not change the selected model/checkpoint.": "لا تغير الأوزان المختارة عند قراءة عوامل الإنتاج من صورة أو من ملف",
452+
"Send seed when sending prompt or image to other interface": "عند إرسال صورة أو طلب ألحق البذرة أيضا",
396453
"Font for image grids that have text": "نوع الخط في جداول الصور التي تحتوي على نصوص",
397454
"Enable full page image viewer": "اسمح بعرض الصور في وضع ملئ الشاشة",
398455
"Show images zoomed in by default in full page image viewer": "اعرض الصور مقربة عند استخدام وضع ملئ الشاشة",
399456
"Show generation progress in window title.": "أظهر التقدم في عنوان النافذة",
400457
"Quicksettings list": "قائمة الإعدادات السريعة",
401458
"List of setting names, separated by commas, for settings that should go to the quick access bar at the top, rather than the usual setting tab. See modules/shared.py for setting names. Requires restarting to apply.": "قائمة مقسمة بفواصل لأسماء الإعدادات التي يجب أن تظهر في الأعلى لتسهيل الوصول إليها، انظر إلى modules/shared.py لمعرفة الأسماء، يتطلب إعادة تشغيل",
402459
"Localization (requires restart)": "اللغة (تتطلب إعادة تشغيل)",
460+
"pt_BR": "البرتغالية",
461+
"zh_CN": "الصينية",
462+
"ko_KR": "الكورية",
463+
"fr_FR": "الفرنسية",
464+
"ru_RU": "الروسية",
465+
"ar_AR": "العربية",
466+
"tr_TR": "التركية",
467+
"it_IT": "الإيطالية",
468+
"ja_JP": "اليابانية",
469+
"de_DE": "الألمانية",
470+
"zh_TW": "الصينية (تايوان)",
471+
"es_ES": "الإسبانية",
403472
"Sampler parameters": "عوامل أساليب الخطو",
404473
"Hide samplers in user interface (requires restart)": "اخف أساليب الخطو التالية (يتطلب إعادة تشغيل)",
405474
"eta (noise multiplier) for DDIM": "العامل Eta η لأسلوب الخطو DDIM",
@@ -420,5 +489,30 @@
420489
"Request browser notifications": "اطلب تنبيهات المتصفح",
421490
"Download localization template": "حمل ملف اللغة",
422491
"Reload custom script bodies (No ui updates, No restart)": "أعد تحميل الأدوات الخاصة (بدون واجهة المستخدم ولا يحتاج إعادة تشغيل)",
423-
"Restart Gradio and Refresh components (Custom Scripts, ui.py, js and css only)": "أعد تشغيل gradio وتحميل الأدوات الخاصة وواجهة المستخدم"
424-
}
492+
"Restart Gradio and Refresh components (Custom Scripts, ui.py, js and css only)": "أعد تشغيل gradio وتحميل الأدوات الخاصة وواجهة المستخدم",
493+
"⤡": "",
494+
"⊞": "",
495+
"×": "×",
496+
"❮": "",
497+
"❯": "",
498+
"•": "",
499+
"Label": "Label",
500+
"File": "File",
501+
"Image": "Image",
502+
"Check progress": "Check progress",
503+
"Check progress (first)": "Check progress (first)",
504+
"Textbox": "Textbox",
505+
"Image for img2img": "Image for img2img",
506+
"Image for inpainting with mask": "Image for inpainting with mask",
507+
"Mask": "Mask",
508+
"Mask mode": "Mask mode",
509+
"Masking mode": "Masking mode",
510+
"Resize mode": "Resize mode",
511+
"Prev batch": "Prev batch",
512+
"Next batch": "Next batch",
513+
"Refresh page": "Refresh page",
514+
"Date to": "Date to",
515+
"Number": "Number",
516+
"set_index": "set_index",
517+
"Checkbox": "Checkbox"
518+
}

0 commit comments

Comments
 (0)