Cachoups commited on
Commit
e853829
·
verified ·
1 Parent(s): bebfc38

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -14
app.py CHANGED
@@ -81,13 +81,7 @@ def process_paragraph_1_sent(paragraph):
81
  paragraph_index = int(paragraph.split(':')[0].replace('Paragraph ', '')) - 1
82
  selected_paragraph = stored_paragraphs_1[paragraph_index]
83
  results = text_to_sentiment(selected_paragraph)
84
- if isinstance(results, list) and isinstance(results[0], dict):
85
- # Create a dictionary from the results
86
- output = {result['label']: result['score'] for result in results}
87
- else:
88
- output = {"Error": "Unexpected output format"}
89
-
90
- return output
91
  except (IndexError, ValueError):
92
  return {"Error": "Unexpected output format"}
93
  def process_paragraph_1_sent_tone(paragraph):
@@ -119,13 +113,7 @@ def process_paragraph_2_sent(paragraph):
119
  paragraph_index = int(paragraph.split(':')[0].replace('Paragraph ', '')) - 1
120
  selected_paragraph = stored_paragraphs_2[paragraph_index]
121
  results = text_to_sentiment(selected_paragraph)
122
- if isinstance(results, list) and isinstance(results[0], dict):
123
- # Create a dictionary from the results
124
- output = {result['label']: result['score'] for result in results}
125
- else:
126
- output = {"Error": "Unexpected output format"}
127
-
128
- return output
129
  except (IndexError, ValueError):
130
  return {"Error": "Unexpected output format"}
131
  def process_paragraph_2_sent_tone(paragraph):
 
81
  paragraph_index = int(paragraph.split(':')[0].replace('Paragraph ', '')) - 1
82
  selected_paragraph = stored_paragraphs_1[paragraph_index]
83
  results = text_to_sentiment(selected_paragraph)
84
+ return results
 
 
 
 
 
 
85
  except (IndexError, ValueError):
86
  return {"Error": "Unexpected output format"}
87
  def process_paragraph_1_sent_tone(paragraph):
 
113
  paragraph_index = int(paragraph.split(':')[0].replace('Paragraph ', '')) - 1
114
  selected_paragraph = stored_paragraphs_2[paragraph_index]
115
  results = text_to_sentiment(selected_paragraph)
116
+ return results
 
 
 
 
 
 
117
  except (IndexError, ValueError):
118
  return {"Error": "Unexpected output format"}
119
  def process_paragraph_2_sent_tone(paragraph):