|
145 | 145 | sd_model_checkpoint_component = None
|
146 | 146 | create_train_dreambooth_component = None
|
147 | 147 |
|
| 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 | + |
148 | 172 | def reload_hypernetworks():
|
149 | 173 | from modules.hypernetworks import hypernetwork
|
150 | 174 | global hypernetworks
|
@@ -304,29 +328,6 @@ def refresh_sagemaker_endpoints(username=None):
|
304 | 328 | if not username:
|
305 | 329 | return sagemaker_endpoints
|
306 | 330 |
|
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 |
| - |
330 | 331 | if industrial_model != '':
|
331 | 332 | params = {
|
332 | 333 | 'industrial_model': industrial_model
|
|
0 commit comments