Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,11 +46,9 @@ def generate_reason(product_desc, channel):
|
|
| 46 |
if not reasoning_model:
|
| 47 |
return "⚠️ Reasoning model not loaded. Cannot generate a reason."
|
| 48 |
|
| 49 |
-
prompt
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
Product: {product_desc}
|
| 53 |
-
"""
|
| 54 |
try:
|
| 55 |
out = reasoning_model(prompt, max_new_tokens=120, truncation=True)
|
| 56 |
return out[0]["generated_text"].strip()
|
|
@@ -167,7 +165,8 @@ def suggest_channels(product_desc, region_code):
|
|
| 167 |
reason = generate_reason(product_desc, channel)
|
| 168 |
|
| 169 |
# Build a search query to find relevant influencers and content.
|
| 170 |
-
|
|
|
|
| 171 |
site_filter = channel.lower() + ".com" if channel != "YouTube" else None
|
| 172 |
|
| 173 |
# Get relevant links from the respective search API.
|
|
|
|
| 46 |
if not reasoning_model:
|
| 47 |
return "⚠️ Reasoning model not loaded. Cannot generate a reason."
|
| 48 |
|
| 49 |
+
# New, simpler prompt to avoid repetition.
|
| 50 |
+
prompt = f"As a social media marketing expert, provide a brief, actionable marketing strategy for {product_desc} on {channel}."
|
| 51 |
+
|
|
|
|
|
|
|
| 52 |
try:
|
| 53 |
out = reasoning_model(prompt, max_new_tokens=120, truncation=True)
|
| 54 |
return out[0]["generated_text"].strip()
|
|
|
|
| 165 |
reason = generate_reason(product_desc, channel)
|
| 166 |
|
| 167 |
# Build a search query to find relevant influencers and content.
|
| 168 |
+
# New, more concise query to get better search results.
|
| 169 |
+
query = f"{product_desc} {channel} influencers"
|
| 170 |
site_filter = channel.lower() + ".com" if channel != "YouTube" else None
|
| 171 |
|
| 172 |
# Get relevant links from the respective search API.
|