Matteo08 commited on
Commit
b3f00bc
·
verified ·
1 Parent(s): e730ebb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -37,19 +37,12 @@ def analyze_book(title, reviews_text, avg_units_sold):
37
  None,
38
  )
39
 
40
- if isinstance(data, list) and len(data) > 0:
41
- result = data[0]
42
- else:
43
- result = data
44
-
45
- summary = (
46
- f"Book: {title}\n\n"
47
- f"Pricing Decision: {result.get('pricing_decision', 'Error')}\n"
48
- f"Sentiment: {result.get('sentiment', 'N/A')}"
49
  )
50
 
51
- return summary, "Processed via n8n", None
52
-
53
  except Exception as e:
54
  return f"Error: {str(e)}", "Request failed", None
55
 
 
37
  None,
38
  )
39
 
40
+ return (
41
+ f"Status code: {response.status_code}\nParsed JSON:\n{data}",
42
+ f"Type: {type(data).__name__}",
43
+ None,
 
 
 
 
 
44
  )
45
 
 
 
46
  except Exception as e:
47
  return f"Error: {str(e)}", "Request failed", None
48