alex-abb commited on
Commit
0ddcccd
·
verified ·
1 Parent(s): 8ac912b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -33,11 +33,8 @@ Respond only with the category name, without any additional explanation or text.
33
  '''
34
  })
35
 
36
- print("API Response:", output) # Print the full API response
37
-
38
  if isinstance(output, list) and len(output) > 0:
39
  generated_text = output[0].get('generated_text', '')
40
- print("Generated Text:", generated_text) # Print the generated text
41
  # Extract the last non-empty line as the category
42
  lines = [line.strip().lower() for line in generated_text.split('\n') if line.strip()]
43
  if lines:
@@ -53,11 +50,9 @@ if response.status_code == 200:
53
  pl7_element = soup.find(class_='pl-7')
54
  if pl7_element:
55
  pl7_text = pl7_element.text.strip()
56
- print("Post content:")
57
- print(pl7_text)
58
- print("\nAnalyzing sentiment...")
59
  sentiment = analyze_sentiment(pl7_text)
60
- print(f"\nSentiment category: {sentiment}")
61
  else:
62
  print("No post found with class 'pl-7'")
63
  else:
 
33
  '''
34
  })
35
 
 
 
36
  if isinstance(output, list) and len(output) > 0:
37
  generated_text = output[0].get('generated_text', '')
 
38
  # Extract the last non-empty line as the category
39
  lines = [line.strip().lower() for line in generated_text.split('\n') if line.strip()]
40
  if lines:
 
50
  pl7_element = soup.find(class_='pl-7')
51
  if pl7_element:
52
  pl7_text = pl7_element.text.strip()
53
+ print("Analyzing post...")
 
 
54
  sentiment = analyze_sentiment(pl7_text)
55
+ print(f"Sentiment category: {sentiment}")
56
  else:
57
  print("No post found with class 'pl-7'")
58
  else: