Spaces:
Build error
Build error
Upload 2 files
Browse files
utils.py
CHANGED
@@ -492,23 +492,23 @@ def generate_alpaca_ner_prompt(query):
|
|
492 |
|
493 |
### Input:
|
494 |
|
495 |
-
What was discussed regarding
|
496 |
-
Company - Apple, Quarter - Q3, Year -
|
497 |
|
498 |
-
How has the growth in Q1 been for the
|
499 |
Company - AMD, Quarter - Q1, Year - none
|
500 |
|
501 |
What was the long term view on GOOGL's cloud business growth as discussed in their earnings call?
|
502 |
Company - Google, Quarter - none, Year - none
|
503 |
|
504 |
-
What is Nvidia's
|
505 |
-
Company - Nvidia, Quarter -
|
506 |
|
507 |
-
What are the
|
508 |
Company - Amazon, Quarter - none, Year - none
|
509 |
|
510 |
-
What did the Analysts ask about CSCO's cybersecurity business in the earnings call?
|
511 |
-
Company - Cisco, Quarter - none, Year -
|
512 |
|
513 |
|
514 |
{query}
|
@@ -517,14 +517,20 @@ Company - Cisco, Quarter - none, Year - none
|
|
517 |
|
518 |
def generate_entities_flan_alpaca_inference_api(prompt):
|
519 |
API_URL = "https://api-inference.huggingface.co/models/declare-lab/flan-alpaca-xl"
|
|
|
|
|
520 |
payload = {
|
521 |
"inputs": prompt,
|
522 |
"parameters": {"do_sample": True, "temperature":0.1, "max_length":80},
|
523 |
-
"options": {"use_cache":
|
524 |
}
|
525 |
-
|
526 |
-
|
527 |
-
|
|
|
|
|
|
|
|
|
528 |
return output
|
529 |
|
530 |
|
@@ -569,6 +575,8 @@ def format_entities_flan_alpaca(model_output):
|
|
569 |
|
570 |
except:
|
571 |
year = None
|
|
|
|
|
572 |
return company, quarter, year
|
573 |
|
574 |
|
|
|
492 |
|
493 |
### Input:
|
494 |
|
495 |
+
What was discussed regarding Services revenue performance in Apple's Q3 2020 earnings call?
|
496 |
+
Company - Apple, Quarter - Q3, Year - 2020
|
497 |
|
498 |
+
How has the growth in Q1 been for the consumer market as seen by AMD?
|
499 |
Company - AMD, Quarter - Q1, Year - none
|
500 |
|
501 |
What was the long term view on GOOGL's cloud business growth as discussed in their earnings call?
|
502 |
Company - Google, Quarter - none, Year - none
|
503 |
|
504 |
+
What is Nvidia's outlook in the data center business in Q3 2020?
|
505 |
+
Company - Nvidia, Quarter - Q3, Year - 2020
|
506 |
|
507 |
+
What are the expansion plans of Amazon in the Asia Pacific region as discussed in their earnings call?
|
508 |
Company - Amazon, Quarter - none, Year - none
|
509 |
|
510 |
+
What did the Analysts ask about CSCO's cybersecurity business in the earnings call in 2016?
|
511 |
+
Company - Cisco, Quarter - none, Year - 2016
|
512 |
|
513 |
|
514 |
{query}
|
|
|
517 |
|
518 |
def generate_entities_flan_alpaca_inference_api(prompt):
|
519 |
API_URL = "https://api-inference.huggingface.co/models/declare-lab/flan-alpaca-xl"
|
520 |
+
API_TOKEN = st.secrets["hg_key"]
|
521 |
+
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
522 |
payload = {
|
523 |
"inputs": prompt,
|
524 |
"parameters": {"do_sample": True, "temperature":0.1, "max_length":80},
|
525 |
+
"options": {"use_cache": False, "wait_for_model": True}
|
526 |
}
|
527 |
+
try:
|
528 |
+
data = json.dumps(payload)
|
529 |
+
response = requests.request("POST", API_URL, data=data)
|
530 |
+
output = json.loads(response.content.decode("utf-8"))[0]["generated_text"]
|
531 |
+
except:
|
532 |
+
output = ""
|
533 |
+
print(output)
|
534 |
return output
|
535 |
|
536 |
|
|
|
575 |
|
576 |
except:
|
577 |
year = None
|
578 |
+
|
579 |
+
print((company, quarter, year))
|
580 |
return company, quarter, year
|
581 |
|
582 |
|