Add authentication support
This commit is contained in:
parent
1bc5089db8
commit
aa5d13f9a7
@ -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>`
|
@ -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,17 +473,17 @@ 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'):
|
|
||||||
with open(os.path.join('./style.css'), 'r', encoding='utf8') as file:
|
with open(os.path.join('./style.css'), 'r', encoding='utf8') as file:
|
||||||
print('Load CSS...')
|
print('Load CSS...')
|
||||||
css += file.read() + '\n'
|
css += file.read() + '\n'
|
||||||
|
|
||||||
interface = gr.Blocks(css=css)
|
interface = gr.Blocks(css=css)
|
||||||
|
|
||||||
with interface:
|
with interface:
|
||||||
dummy_true = gr.Label(value=True, visible=False)
|
dummy_true = gr.Label(value=True, visible=False)
|
||||||
dummy_false = gr.Label(value=False, visible=False)
|
dummy_false = gr.Label(value=False, visible=False)
|
||||||
with gr.Tab('Dreambooth'):
|
with gr.Tab('Dreambooth'):
|
||||||
@ -958,5 +959,19 @@ with interface:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Show the interface
|
# Show the interface
|
||||||
interface.launch()
|
if not username == '':
|
||||||
|
interface.launch(auth=(username, password))
|
||||||
|
else:
|
||||||
|
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)
|
||||||
|
@ -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,17 +386,18 @@ def remove_doublequote(file_path):
|
|||||||
|
|
||||||
return file_path
|
return file_path
|
||||||
|
|
||||||
|
def UI(username, password):
|
||||||
|
|
||||||
css = ''
|
css = ''
|
||||||
|
|
||||||
if os.path.exists('./style.css'):
|
if os.path.exists('./style.css'):
|
||||||
with open(os.path.join('./style.css'), 'r', encoding='utf8') as file:
|
with open(os.path.join('./style.css'), 'r', encoding='utf8') as file:
|
||||||
print('Load CSS...')
|
print('Load CSS...')
|
||||||
css += file.read() + '\n'
|
css += file.read() + '\n'
|
||||||
|
|
||||||
interface = gr.Blocks(css=css)
|
interface = gr.Blocks(css=css)
|
||||||
|
|
||||||
with interface:
|
with interface:
|
||||||
dummy_true = gr.Label(value=True, visible=False)
|
dummy_true = gr.Label(value=True, visible=False)
|
||||||
dummy_false = gr.Label(value=False, visible=False)
|
dummy_false = gr.Label(value=False, visible=False)
|
||||||
with gr.Tab('Finetuning'):
|
with gr.Tab('Finetuning'):
|
||||||
@ -791,5 +792,19 @@ with interface:
|
|||||||
gradio_convert_model_tab()
|
gradio_convert_model_tab()
|
||||||
|
|
||||||
|
|
||||||
# Show the interface
|
# Show the interface
|
||||||
interface.launch()
|
if not username == '':
|
||||||
|
interface.launch(auth=(username, password))
|
||||||
|
else:
|
||||||
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user