Hasitha16 commited on
Commit
2245398
·
verified ·
1 Parent(s): 1a7ffb3

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -5
main.py CHANGED
@@ -79,21 +79,21 @@ async def analyze(data: ReviewInput, x_api_key: str = Header(None)):
79
  try:
80
  # Smart summary logic based on verbosity and intelligence
81
  if data.verbosity.lower() == "brief":
82
- summary = summarize_review(data.text)
83
  else:
84
  summary = smart_summarize(data.text, n_clusters=2 if data.intelligence else 1)
85
 
86
  sentiment = sentiment_pipeline(data.text)[0]
87
- emotion = "joy" # Placeholder
88
 
89
  # Auto-detection logic
90
- industry = data.industry if data.industry and data.industry.lower() != "auto-detect" else detect_industry(data.text)
91
- product_category = data.product_category if data.product_category and data.product_category.lower() != "auto-detect" else detect_product_category(data.text)
92
  device = "Web"
93
 
94
  follow_up_response = None
95
  if data.follow_up:
96
- follow_up_response = answer_followup(data.text, data.follow_up)
97
 
98
  return {
99
  "summary": summary,
 
79
  try:
80
  # Smart summary logic based on verbosity and intelligence
81
  if data.verbosity.lower() == "brief":
82
+ summary = summarize_review(data.text, max_len=40, min_len=8)
83
  else:
84
  summary = smart_summarize(data.text, n_clusters=2 if data.intelligence else 1)
85
 
86
  sentiment = sentiment_pipeline(data.text)[0]
87
+ emotion = "joy"
88
 
89
  # Auto-detection logic
90
+ industry: auto_fill(data.industry, detect_industry(data.text)),
91
+ product_category: auto_fill(data.product_category, detect_product_category(data.text)),
92
  device = "Web"
93
 
94
  follow_up_response = None
95
  if data.follow_up:
96
+ follow_up_response = answer_followup(data.text, data.follow_up, data.verbosity)
97
 
98
  return {
99
  "summary": summary,