Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyongliang committed Mar 5, 2023
1 parent c25a16c commit 2fe03e2
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions modules/shared.py
Expand Up @@ -145,6 +145,30 @@
sd_model_checkpoint_component = None
create_train_dreambooth_component = None

response = requests.get(url=f'{api_endpoint}/sd/industrialmodel')
if response.status_code == 200:
industrial_model = response.text
else:
model_name = 'stable-diffusion-webui'
model_description = model_name
inputs = {
'model_algorithm': 'stable-diffusion-webui',
'model_name': model_name,
'model_description': model_description,
'model_extra': '{"visible": "false"}',
'model_samples': '',
'file_content': {
'data': [(lambda x: int(x))(x) for x in open(os.path.join(script_path, 'logo.ico'), 'rb').read()]
}
}

response = requests.post(url=f'{api_endpoint}/industrialmodel', json = inputs)
if response.status_code == 200:
body = json.loads(response.text)
industrial_model = body['id']
else:
print(response.text)

def reload_hypernetworks():
from modules.hypernetworks import hypernetwork
global hypernetworks
Expand Down Expand Up @@ -304,29 +328,6 @@ def refresh_sagemaker_endpoints(username=None):
if not username:
return sagemaker_endpoints

if industrial_model == '':
response = requests.get(url=f'{api_endpoint}/sd/industrialmodel')
if response.status_code == 200:
industrial_model = response.text
else:
model_name = 'stable-diffusion-webui'
model_description = model_name
inputs = {
'model_algorithm': 'stable-diffusion-webui',
'model_name': model_name,
'model_description': model_description,
'model_extra': '{"visible": "false"}',
'model_samples': '',
'file_content': {
'data': [(lambda x: int(x))(x) for x in open(os.path.join(script_path, 'logo.ico'), 'rb').read()]
}
}

response = requests.post(url=f'{api_endpoint}/industrialmodel', json = inputs)
if response.status_code == 200:
body = json.loads(response.text)
industrial_model = body['id']

if industrial_model != '':
params = {
'industrial_model': industrial_model
Expand Down

0 comments on commit 2fe03e2

Please sign in to comment.