Update app.py
Browse files
app.py
CHANGED
|
@@ -54,7 +54,6 @@ def tool_generate_image(prompt: str):
|
|
| 54 |
print(f"❌ Image Tool Error: {e}")
|
| 55 |
return None
|
| 56 |
|
| 57 |
-
# --- Text Generation Helper ---
|
| 58 |
def tool_generate_text(prompt: str, system_message: str = "You are a helpful assistant.", max_tokens: int = 1024) -> str:
|
| 59 |
try:
|
| 60 |
response = nebius_client.chat.completions.create(
|
|
@@ -70,7 +69,6 @@ def tool_generate_text(prompt: str, system_message: str = "You are a helpful ass
|
|
| 70 |
except Exception as e:
|
| 71 |
return f"Error: {e}"
|
| 72 |
|
| 73 |
-
# --- Market Insights Summarization Tool ---
|
| 74 |
def tool_summarize_market_insights(text: str):
|
| 75 |
print("🧠 Summarization Tool Running...")
|
| 76 |
try:
|
|
@@ -162,10 +160,27 @@ def chat_response(message, history):
|
|
| 162 |
history.append({"role": "assistant", "content": f"Error: {e}"})
|
| 163 |
return history, ""
|
| 164 |
|
| 165 |
-
# --- 5. GRADIO
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
# HEADER
|
| 168 |
-
with gr.Column():
|
| 169 |
gr.Markdown("# 🖼️ AutoBrand Studio")
|
| 170 |
gr.Markdown("Autonomous Agent powered by AI Models, MCP Tools & Web Search. Connect Claude Desktop to use these tools!")
|
| 171 |
|
|
|
|
| 54 |
print(f"❌ Image Tool Error: {e}")
|
| 55 |
return None
|
| 56 |
|
|
|
|
| 57 |
def tool_generate_text(prompt: str, system_message: str = "You are a helpful assistant.", max_tokens: int = 1024) -> str:
|
| 58 |
try:
|
| 59 |
response = nebius_client.chat.completions.create(
|
|
|
|
| 69 |
except Exception as e:
|
| 70 |
return f"Error: {e}"
|
| 71 |
|
|
|
|
| 72 |
def tool_summarize_market_insights(text: str):
|
| 73 |
print("🧠 Summarization Tool Running...")
|
| 74 |
try:
|
|
|
|
| 160 |
history.append({"role": "assistant", "content": f"Error: {e}"})
|
| 161 |
return history, ""
|
| 162 |
|
| 163 |
+
# --- 5. GRADIO THEME & CSS ---
|
| 164 |
+
theme = gr.themes.Soft(
|
| 165 |
+
primary_hue="indigo",
|
| 166 |
+
secondary_hue="blue",
|
| 167 |
+
neutral_hue="slate",
|
| 168 |
+
).set(
|
| 169 |
+
button_primary_background_fill="linear-gradient(90deg, #6366f1 0%, #4338ca 100%)",
|
| 170 |
+
button_primary_background_fill_hover="linear-gradient(90deg, #4f46e5 0%, #3730a3 100%)",
|
| 171 |
+
button_primary_text_color="white",
|
| 172 |
+
block_title_text_weight="600",
|
| 173 |
+
block_shadow="0 4px 6px rgba(0,0,0,0.1)",
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
custom_css = """
|
| 177 |
+
#main-header {text-align: center; margin-bottom: 2rem;}
|
| 178 |
+
"""
|
| 179 |
+
|
| 180 |
+
# --- 6. GRADIO UI ---
|
| 181 |
+
with gr.Blocks(theme=theme, css=custom_css, title="AutoBrand MCP Studio") as demo:
|
| 182 |
# HEADER
|
| 183 |
+
with gr.Column(elem_id="main-header"):
|
| 184 |
gr.Markdown("# 🖼️ AutoBrand Studio")
|
| 185 |
gr.Markdown("Autonomous Agent powered by AI Models, MCP Tools & Web Search. Connect Claude Desktop to use these tools!")
|
| 186 |
|