Add authentication support

This commit is contained in:
bmaltais 2022-12-21 09:05:06 -05:00
parent 1bc5089db8
commit aa5d13f9a7
3 changed files with 888 additions and 853 deletions

View File

@ -11,3 +11,8 @@ You can find the dreambooth solution spercific [Dreambooth README](README_dreamb
## Finetune ## Finetune
You can find the finetune solution spercific [Finetune README](README_finetune.md) You can find the finetune solution spercific [Finetune README](README_finetune.md)
## Change history
* 12/21 (v9.7) update:
- add optional GUI authentication support via: `python fine_tune.py --username=<name> --password=<password>`

View File

@ -10,6 +10,7 @@ import os
import subprocess import subprocess
import pathlib import pathlib
import shutil import shutil
import argparse
from library.dreambooth_folder_creation_gui import ( from library.dreambooth_folder_creation_gui import (
gradio_dreambooth_folder_creation_tab, gradio_dreambooth_folder_creation_tab,
) )
@ -472,7 +473,7 @@ def set_pretrained_model_name_or_path_input(value, v2, v_parameterization):
return value, v2, v_parameterization return value, v2, v_parameterization
def UI(username, password):
css = '' css = ''
if os.path.exists('./style.css'): if os.path.exists('./style.css'):
@ -959,4 +960,18 @@ with interface:
) )
# Show the interface # Show the interface
if not username == '':
interface.launch(auth=(username, password))
else:
interface.launch() interface.launch()
if __name__ == '__main__':
# torch.cuda.set_per_process_memory_fraction(0.48)
parser = argparse.ArgumentParser()
parser.add_argument("--username", type=str, default='', help="Username for authentication")
parser.add_argument("--password", type=str, default='', help="Password for authentication")
args = parser.parse_args()
UI(username=args.username, password=args.password)

View File

@ -5,6 +5,7 @@ import os
import subprocess import subprocess
import pathlib import pathlib
import shutil import shutil
import argparse
# from easygui import fileopenbox, filesavebox, diropenbox, msgbox # from easygui import fileopenbox, filesavebox, diropenbox, msgbox
from library.basic_caption_gui import gradio_basic_caption_gui_tab from library.basic_caption_gui import gradio_basic_caption_gui_tab
@ -99,9 +100,8 @@ def save_configuration(
} }
# Save the data to the selected file # Save the data to the selected file
# with open(file_path, 'w') as file: with open(file_path, 'w') as file:
# json.dump(variables, file) json.dump(variables, file)
# msgbox('File was saved...')
return file_path return file_path
@ -386,6 +386,7 @@ def remove_doublequote(file_path):
return file_path return file_path
def UI(username, password):
css = '' css = ''
@ -792,4 +793,18 @@ with interface:
# Show the interface # Show the interface
if not username == '':
interface.launch(auth=(username, password))
else:
interface.launch() interface.launch()
if __name__ == '__main__':
# torch.cuda.set_per_process_memory_fraction(0.48)
parser = argparse.ArgumentParser()
parser.add_argument("--username", type=str, default='', help="Username for authentication")
parser.add_argument("--password", type=str, default='', help="Password for authentication")
args = parser.parse_args()
UI(username=args.username, password=args.password)