Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -75,8 +75,14 @@ def swap_faces(source_image, source_face_index, destination_image, destination_f
|
|
75 |
def generate_image(prompt, width, height, seed, model_name):
|
76 |
if seed == -1:
|
77 |
seed = random.randint(0, MAX_SEED)
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
def display_gallery():
|
82 |
st.header("Galería de Imágenes Guardadas")
|
@@ -120,7 +126,7 @@ def generate_variations(prompt, num_variants, use_enhanced):
|
|
120 |
prompts = set()
|
121 |
while len(prompts) < num_variants:
|
122 |
instruction = random.choice(instructions)
|
123 |
-
enhanced_prompt = f"{
|
124 |
prompts.add(enhanced_prompt)
|
125 |
return list(prompts)
|
126 |
|
@@ -212,4 +218,4 @@ def main():
|
|
212 |
display_gallery()
|
213 |
|
214 |
if __name__ == "__main__":
|
215 |
-
main()
|
|
|
75 |
def generate_image(prompt, width, height, seed, model_name):
|
76 |
if seed == -1:
|
77 |
seed = random.randint(0, MAX_SEED)
|
78 |
+
try:
|
79 |
+
image = client.text_to_image(prompt=prompt, height=height, width=width, model=model_name)
|
80 |
+
return image, seed
|
81 |
+
except Exception as e:
|
82 |
+
st.error(f"Error al generar imagen: {e}")
|
83 |
+
if hasattr(e, 'response') and e.response is not None:
|
84 |
+
st.error(f"Detalles del error: {e.response.text}")
|
85 |
+
return None, seed
|
86 |
|
87 |
def display_gallery():
|
88 |
st.header("Galería de Imágenes Guardadas")
|
|
|
126 |
prompts = set()
|
127 |
while len(prompts) < num_variants:
|
128 |
instruction = random.choice(instructions)
|
129 |
+
enhanced_prompt = f"{prompt}"
|
130 |
prompts.add(enhanced_prompt)
|
131 |
return list(prompts)
|
132 |
|
|
|
218 |
display_gallery()
|
219 |
|
220 |
if __name__ == "__main__":
|
221 |
+
main()
|