Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ NEBIUS_API_KEY = os.environ.get("NEBIUS_API_KEY")
|
|
| 12 |
# Make sure to include "https://" and the "/v1/" path
|
| 13 |
NEBIUS_BASE_URL = "https://api.tokenfactory.nebius.com/v1/" # Use the URL from your Nebius dashboard
|
| 14 |
TEXT_MODEL = "meta-llama/Llama-3.3-70B-Instruct" # Use a text model from your dashboard
|
| 15 |
-
IMAGE_MODEL = "black-forest-labs/flux-
|
| 16 |
|
| 17 |
# Check if the API key is set
|
| 18 |
if not NEBIUS_API_KEY:
|
|
@@ -119,7 +119,7 @@ def run_brand_agent_plan(company_name, business_type, style, progress=gr.Progres
|
|
| 119 |
# 3. RESULT
|
| 120 |
return results["logo_url"], results["palette_url"], results["copy_text"], log_message
|
| 121 |
|
| 122 |
-
# --- 4. CHATBOT FUNCTION
|
| 123 |
def chat_with_brand_agent(message, history):
|
| 124 |
system_prompt_chat = "You are a friendly and creative branding expert. A user is asking for ideas for their new brand. Give them suggestions, ask clarifying questions, and help them brainstorm."
|
| 125 |
|
|
@@ -138,10 +138,8 @@ def chat_with_brand_agent(message, history):
|
|
| 138 |
)
|
| 139 |
bot_message = response.choices[0].message.content
|
| 140 |
|
| 141 |
-
# *** FIX ***: Append the new (user, bot) pair to the history
|
| 142 |
history.append((message, bot_message))
|
| 143 |
|
| 144 |
-
# *** FIX ***: Return the updated history and clear the textbox
|
| 145 |
return history, ""
|
| 146 |
|
| 147 |
except Exception as e:
|
|
|
|
| 12 |
# Make sure to include "https://" and the "/v1/" path
|
| 13 |
NEBIUS_BASE_URL = "https://api.tokenfactory.nebius.com/v1/" # Use the URL from your Nebius dashboard
|
| 14 |
TEXT_MODEL = "meta-llama/Llama-3.3-70B-Instruct" # Use a text model from your dashboard
|
| 15 |
+
IMAGE_MODEL = "black-forest-labs/flux-dev" # Use an image model from your dashboard
|
| 16 |
|
| 17 |
# Check if the API key is set
|
| 18 |
if not NEBIUS_API_KEY:
|
|
|
|
| 119 |
# 3. RESULT
|
| 120 |
return results["logo_url"], results["palette_url"], results["copy_text"], log_message
|
| 121 |
|
| 122 |
+
# --- 4. CHATBOT FUNCTION ---
|
| 123 |
def chat_with_brand_agent(message, history):
|
| 124 |
system_prompt_chat = "You are a friendly and creative branding expert. A user is asking for ideas for their new brand. Give them suggestions, ask clarifying questions, and help them brainstorm."
|
| 125 |
|
|
|
|
| 138 |
)
|
| 139 |
bot_message = response.choices[0].message.content
|
| 140 |
|
|
|
|
| 141 |
history.append((message, bot_message))
|
| 142 |
|
|
|
|
| 143 |
return history, ""
|
| 144 |
|
| 145 |
except Exception as e:
|