Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -75,11 +75,20 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+ | |
| 75 | 
             
                    "seed": seed if seed != -1 else random.randint(1, 1000000000)
         | 
| 76 | 
             
                    }
         | 
| 77 |  | 
| 78 | 
            -
                 | 
| 79 | 
            -
                 | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 83 |  | 
| 84 | 
             
            css = """
         | 
| 85 | 
             
            * {}
         | 
|  | |
| 75 | 
             
                    "seed": seed if seed != -1 else random.randint(1, 1000000000)
         | 
| 76 | 
             
                    }
         | 
| 77 |  | 
| 78 | 
            +
                response = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
         | 
| 79 | 
            +
                if response.status_code != 200:
         | 
| 80 | 
            +
                    print(f"Ошибка: Не удалось получить изображение. Статус ответа: {response.status_code}")
         | 
| 81 | 
            +
                    print(f"Содержимое ответа: {response.text}")
         | 
| 82 | 
            +
                    return None
         | 
| 83 | 
            +
                
         | 
| 84 | 
            +
                try:
         | 
| 85 | 
            +
                    image_bytes = response.content
         | 
| 86 | 
            +
                    image = Image.open(io.BytesIO(image_bytes))
         | 
| 87 | 
            +
                    print(f'\033[1mГенерация {key} завершена!\033[0m ({prompt})')
         | 
| 88 | 
            +
                    return image
         | 
| 89 | 
            +
                except Exception as e:
         | 
| 90 | 
            +
                    print(f"Ошибка при попытке открыть изображение: {e}")
         | 
| 91 | 
            +
                    return None
         | 
| 92 |  | 
| 93 | 
             
            css = """
         | 
| 94 | 
             
            * {}
         | 
 
			
