Spaces:
Sleeping
Sleeping
tensorgirl
commited on
Update utils.py
Browse files
utils.py
CHANGED
@@ -92,7 +92,11 @@ def summary(input_json):
|
|
92 |
output["Stock Ticker"] = input_json['symbol']
|
93 |
|
94 |
answer = "You are an financial expert " + callAzure(promptShort[id], long_text) + "Do not exceed over 500 characters"
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
|
97 |
prompt = "Answer in 1 word only. Financial SEO tag for this news article. Nothing more than that"
|
98 |
answer = callAzure(prompt, output['Short Summary'])
|
@@ -122,7 +126,7 @@ def summary(input_json):
|
|
122 |
max_tokens=2000,
|
123 |
)
|
124 |
|
125 |
-
output['Long summary'] = completion.choices[0].message
|
126 |
# response = client.images.generate(
|
127 |
# model="dall-e-3",
|
128 |
# prompt=headline.text,
|
|
|
92 |
output["Stock Ticker"] = input_json['symbol']
|
93 |
|
94 |
answer = "You are an financial expert " + callAzure(promptShort[id], long_text) + "Do not exceed over 500 characters"
|
95 |
+
try:
|
96 |
+
idx = answer.index("\n")
|
97 |
+
except:
|
98 |
+
idx = -2
|
99 |
+
output['Short Summary'] = answer[idx+2:]
|
100 |
|
101 |
prompt = "Answer in 1 word only. Financial SEO tag for this news article. Nothing more than that"
|
102 |
answer = callAzure(prompt, output['Short Summary'])
|
|
|
126 |
max_tokens=2000,
|
127 |
)
|
128 |
|
129 |
+
output['Long summary'] = completion.choices[0].message['content']
|
130 |
# response = client.images.generate(
|
131 |
# model="dall-e-3",
|
132 |
# prompt=headline.text,
|