Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -78,8 +78,8 @@ def auto_fill(value: Optional[str], fallback: str) -> str:
|
|
78 |
async def analyze(data: ReviewInput, x_api_key: str = Header(None)):
|
79 |
if x_api_key != VALID_API_KEY:
|
80 |
raise HTTPException(status_code=401, detail="❌ Unauthorized: Invalid API key")
|
81 |
-
if len(data.text.split()) <
|
82 |
-
raise HTTPException(status_code=400, detail="⚠️ Review too short for analysis (min.
|
83 |
|
84 |
try:
|
85 |
# Smart summary logic based on verbosity and intelligence
|
@@ -92,8 +92,8 @@ async def analyze(data: ReviewInput, x_api_key: str = Header(None)):
|
|
92 |
emotion = "joy"
|
93 |
|
94 |
# Auto-detection logic
|
95 |
-
industry
|
96 |
-
product_category
|
97 |
device = "Web"
|
98 |
|
99 |
follow_up_response = None
|
|
|
78 |
async def analyze(data: ReviewInput, x_api_key: str = Header(None)):
|
79 |
if x_api_key != VALID_API_KEY:
|
80 |
raise HTTPException(status_code=401, detail="❌ Unauthorized: Invalid API key")
|
81 |
+
if len(data.text.split()) < 20:
|
82 |
+
raise HTTPException(status_code=400, detail="⚠️ Review too short for analysis (min. 20 words).")
|
83 |
|
84 |
try:
|
85 |
# Smart summary logic based on verbosity and intelligence
|
|
|
92 |
emotion = "joy"
|
93 |
|
94 |
# Auto-detection logic
|
95 |
+
industry = detect_industry(data.text) if not data.industry or "auto" in data.industry.lower() else data.industry
|
96 |
+
product_category = detect_product_category(data.text) if not data.product_category or "auto" in data.product_category.lower() else data.product_category
|
97 |
device = "Web"
|
98 |
|
99 |
follow_up_response = None
|