Update app.py
Browse files
app.py
CHANGED
|
@@ -95,11 +95,15 @@ class HyperrealisticPromptGenerator:
|
|
| 95 |
atmosphere = self._choose_random(self.ATMOSPHERES)
|
| 96 |
|
| 97 |
prompt = f"""
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
def generate_prompt_automatic(self):
|
| 102 |
-
return self.generate_single_prompt()
|
| 103 |
|
| 104 |
|
| 105 |
# ==============================================================
|
|
@@ -139,9 +143,9 @@ def analizar_imagen_y_generar_prompt(image_base64):
|
|
| 139 |
response = requests.post(API_URL, headers=headers, json=json_data)
|
| 140 |
response.raise_for_status()
|
| 141 |
text_resp = response.json()["choices"][0]["message"]["content"]
|
| 142 |
-
return f"
|
| 143 |
except Exception:
|
| 144 |
-
return f"
|
| 145 |
|
| 146 |
|
| 147 |
# ==============================================================
|
|
@@ -207,7 +211,7 @@ def chat_sambanova(user_message, image_input, auto_mode, chat_history, loading_s
|
|
| 207 |
|
| 208 |
|
| 209 |
def generar_prompt_interno():
|
| 210 |
-
return gen.generate_prompt_automatic()
|
| 211 |
|
| 212 |
|
| 213 |
# ==============================================================
|
|
@@ -245,7 +249,7 @@ with gr.Blocks(css=css_batuto, theme="gradio/soft") as demo:
|
|
| 245 |
copy_button = gr.Button("📋 Copiar Prompt")
|
| 246 |
|
| 247 |
with gr.Row():
|
| 248 |
-
loading = gr.Markdown(value=
|
| 249 |
|
| 250 |
btn_send.click(
|
| 251 |
fn=chat_sambanova,
|
|
@@ -263,7 +267,6 @@ with gr.Blocks(css=css_batuto, theme="gradio/soft") as demo:
|
|
| 263 |
outputs=[msg, prompt_output]
|
| 264 |
)
|
| 265 |
|
| 266 |
-
# ✅ Botón copiar funcional con alerta
|
| 267 |
copy_button.click(
|
| 268 |
None,
|
| 269 |
[],
|
|
|
|
| 95 |
atmosphere = self._choose_random(self.ATMOSPHERES)
|
| 96 |
|
| 97 |
prompt = f"""
|
| 98 |
+
Highly detailed hyperrealistic full-body portrait of a {selected_role}, {age}, with {hair_style}, {hair_color} hair, and {eye_color} eyes.
|
| 99 |
+
She is {pose}, in a {setting}. {atmosphere}.
|
| 100 |
+
{self.CONDITION_FIXED}
|
| 101 |
+
{self.TECHNICAL_DETAILS}
|
| 102 |
+
"""
|
| 103 |
+
return prompt.strip()
|
| 104 |
|
| 105 |
def generate_prompt_automatic(self):
|
| 106 |
+
return self.generate_single_prompt(), ""
|
| 107 |
|
| 108 |
|
| 109 |
# ==============================================================
|
|
|
|
| 143 |
response = requests.post(API_URL, headers=headers, json=json_data)
|
| 144 |
response.raise_for_status()
|
| 145 |
text_resp = response.json()["choices"][0]["message"]["content"]
|
| 146 |
+
return f"```\n{text_resp}\n```"
|
| 147 |
except Exception:
|
| 148 |
+
return f"```\n[Error generating prompt]\n```"
|
| 149 |
|
| 150 |
|
| 151 |
# ==============================================================
|
|
|
|
| 211 |
|
| 212 |
|
| 213 |
def generar_prompt_interno():
|
| 214 |
+
return gen.generate_prompt_automatic()
|
| 215 |
|
| 216 |
|
| 217 |
# ==============================================================
|
|
|
|
| 249 |
copy_button = gr.Button("📋 Copiar Prompt")
|
| 250 |
|
| 251 |
with gr.Row():
|
| 252 |
+
loading = gr.Markdown(value="", label="Estado")
|
| 253 |
|
| 254 |
btn_send.click(
|
| 255 |
fn=chat_sambanova,
|
|
|
|
| 267 |
outputs=[msg, prompt_output]
|
| 268 |
)
|
| 269 |
|
|
|
|
| 270 |
copy_button.click(
|
| 271 |
None,
|
| 272 |
[],
|