tensorgirl commited on
Commit
b7889d4
1 Parent(s): a3f4b98

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +4 -4
utils.py CHANGED
@@ -107,14 +107,14 @@ def summary(input_json):
107
  try:
108
  idx = answer.index("\n")
109
  except:
110
- idx = 0
111
  output['Short Summary'] = answer[idx+2:]
112
 
113
  answer = callAzure(promptLong[id], long_text)
114
  try:
115
  idx = answer.index("\n")
116
  except:
117
- idx = 0
118
  output['Long summary'] = answer[idx+2:]
119
 
120
  prompt = "1 word Financial SEO tag for this news article"
@@ -122,7 +122,7 @@ def summary(input_json):
122
  try:
123
  idx = answer.index("\n")
124
  except:
125
- idx = 0
126
  output['Tag'] = answer[idx+2:]
127
 
128
  prompt = "Give a single headline for this News Article"
@@ -130,7 +130,7 @@ def summary(input_json):
130
  try:
131
  idx = answer.index("\n")
132
  except:
133
- idx = 0
134
  output['Headline'] = answer[idx+2:]
135
 
136
  utc_now = datetime.datetime.utcnow()
 
107
  try:
108
  idx = answer.index("\n")
109
  except:
110
+ idx = -2
111
  output['Short Summary'] = answer[idx+2:]
112
 
113
  answer = callAzure(promptLong[id], long_text)
114
  try:
115
  idx = answer.index("\n")
116
  except:
117
+ idx = -2
118
  output['Long summary'] = answer[idx+2:]
119
 
120
  prompt = "1 word Financial SEO tag for this news article"
 
122
  try:
123
  idx = answer.index("\n")
124
  except:
125
+ idx = -2
126
  output['Tag'] = answer[idx+2:]
127
 
128
  prompt = "Give a single headline for this News Article"
 
130
  try:
131
  idx = answer.index("\n")
132
  except:
133
+ idx = -2
134
  output['Headline'] = answer[idx+2:]
135
 
136
  utc_now = datetime.datetime.utcnow()