Spaces:
Sleeping
Sleeping
Commit
•
19c4fb0
1
Parent(s):
816350a
Update utils.py
Browse files
utils.py
CHANGED
@@ -23,11 +23,14 @@ def callAzure(prompt,text):
|
|
23 |
url = "https://Meta-Llama-3-70B-Instruct-fkqip-serverless.eastus2.inference.ai.azure.com"
|
24 |
api_key = "o5yaLhTIvg0s5zuYVInBpyneEZO8oonY"
|
25 |
client = OpenAI(base_url=url, api_key=api_key)
|
|
|
|
|
|
|
26 |
response = client.chat.completions.create(
|
27 |
messages=[
|
28 |
{
|
29 |
"role": "user",
|
30 |
-
"content":
|
31 |
}
|
32 |
],
|
33 |
model="azureai",
|
@@ -99,13 +102,19 @@ def summary(input_json):
|
|
99 |
output["Date of time of receiving data from BSE"] = input_json["newsdate"]
|
100 |
|
101 |
output["Stock Ticker"] = input_json['symbol']
|
102 |
-
|
103 |
-
output['Short Summary'] = callAzure(promptShort[id], long_text)
|
104 |
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
prompt = "1 word Financial SEO tag for this news article"
|
108 |
-
|
|
|
|
|
109 |
|
110 |
prompt = "Give a single headline for this News Article"
|
111 |
output['Headline'] = callAzure(prompt, output['Short Summary'])
|
|
|
23 |
url = "https://Meta-Llama-3-70B-Instruct-fkqip-serverless.eastus2.inference.ai.azure.com"
|
24 |
api_key = "o5yaLhTIvg0s5zuYVInBpyneEZO8oonY"
|
25 |
client = OpenAI(base_url=url, api_key=api_key)
|
26 |
+
msg = "{} {}".format(prompt, text)
|
27 |
+
msg = msg[:7000]
|
28 |
+
|
29 |
response = client.chat.completions.create(
|
30 |
messages=[
|
31 |
{
|
32 |
"role": "user",
|
33 |
+
"content": ,
|
34 |
}
|
35 |
],
|
36 |
model="azureai",
|
|
|
102 |
output["Date of time of receiving data from BSE"] = input_json["newsdate"]
|
103 |
|
104 |
output["Stock Ticker"] = input_json['symbol']
|
|
|
|
|
105 |
|
106 |
+
answer = callAzure(promptShort[id], long_text)
|
107 |
+
idx = answer.index("\n")
|
108 |
+
output['Short Summary'] = answer[idx+2:]
|
109 |
+
|
110 |
+
answer = callAzure(promptLong[id], long_text)
|
111 |
+
idx = answer.index("\n")
|
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 |
+
idx = answer.index("\n")
|
117 |
+
output['Tag'] = answer[idx+2:]
|
118 |
|
119 |
prompt = "Give a single headline for this News Article"
|
120 |
output['Headline'] = callAzure(prompt, output['Short Summary'])
|