Spaces:
Running
Running
Commit
•
a3f4b98
1
Parent(s):
8d4b4fb
Update utils.py
Browse files
utils.py
CHANGED
@@ -104,20 +104,34 @@ def summary(input_json):
|
|
104 |
output["Stock Ticker"] = input_json['symbol']
|
105 |
|
106 |
answer = callAzure(promptShort[id], long_text)
|
107 |
-
|
|
|
|
|
|
|
108 |
output['Short Summary'] = answer[idx+2:]
|
109 |
|
110 |
answer = callAzure(promptLong[id], long_text)
|
111 |
-
|
|
|
|
|
|
|
112 |
output['Long summary'] = answer[idx+2:]
|
113 |
|
114 |
prompt = "1 word Financial SEO tag for this news article"
|
115 |
answer = callAzure(prompt, output['Short Summary'])
|
116 |
-
|
|
|
|
|
|
|
117 |
output['Tag'] = answer[idx+2:]
|
118 |
|
119 |
prompt = "Give a single headline for this News Article"
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
utc_now = datetime.datetime.utcnow()
|
123 |
ist_now = utc_now.astimezone(datetime.timezone(datetime.timedelta(hours=5, minutes=30)))
|
|
|
104 |
output["Stock Ticker"] = input_json['symbol']
|
105 |
|
106 |
answer = callAzure(promptShort[id], long_text)
|
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"
|
121 |
answer = callAzure(prompt, output['Short Summary'])
|
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"
|
129 |
+
answer = callAzure(prompt, output['Short Summary'])
|
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()
|
137 |
ist_now = utc_now.astimezone(datetime.timezone(datetime.timedelta(hours=5, minutes=30)))
|