Skip to content

Commit 2b0026e

Browse files
committed
cleanup
1 parent d62af5c commit 2b0026e

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

modules/shared.py

+24-23
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,30 @@
145145
sd_model_checkpoint_component = None
146146
create_train_dreambooth_component = None
147147

148+
response = requests.get(url=f'{api_endpoint}/sd/industrialmodel')
149+
if response.status_code == 200:
150+
industrial_model = response.text
151+
else:
152+
model_name = 'stable-diffusion-webui'
153+
model_description = model_name
154+
inputs = {
155+
'model_algorithm': 'stable-diffusion-webui',
156+
'model_name': model_name,
157+
'model_description': model_description,
158+
'model_extra': '{"visible": "false"}',
159+
'model_samples': '',
160+
'file_content': {
161+
'data': [(lambda x: int(x))(x) for x in open(os.path.join(script_path, 'logo.ico'), 'rb').read()]
162+
}
163+
}
164+
165+
response = requests.post(url=f'{api_endpoint}/industrialmodel', json = inputs)
166+
if response.status_code == 200:
167+
body = json.loads(response.text)
168+
industrial_model = body['id']
169+
else:
170+
print(response.text)
171+
148172
def reload_hypernetworks():
149173
from modules.hypernetworks import hypernetwork
150174
global hypernetworks
@@ -304,29 +328,6 @@ def refresh_sagemaker_endpoints(username=None):
304328
if not username:
305329
return sagemaker_endpoints
306330

307-
if industrial_model == '':
308-
response = requests.get(url=f'{api_endpoint}/sd/industrialmodel')
309-
if response.status_code == 200:
310-
industrial_model = response.text
311-
else:
312-
model_name = 'stable-diffusion-webui'
313-
model_description = model_name
314-
inputs = {
315-
'model_algorithm': 'stable-diffusion-webui',
316-
'model_name': model_name,
317-
'model_description': model_description,
318-
'model_extra': '{"visible": "false"}',
319-
'model_samples': '',
320-
'file_content': {
321-
'data': [(lambda x: int(x))(x) for x in open(os.path.join(script_path, 'logo.ico'), 'rb').read()]
322-
}
323-
}
324-
325-
response = requests.post(url=f'{api_endpoint}/industrialmodel', json = inputs)
326-
if response.status_code == 200:
327-
body = json.loads(response.text)
328-
industrial_model = body['id']
329-
330331
if industrial_model != '':
331332
params = {
332333
'industrial_model': industrial_model

0 commit comments

Comments
 (0)