sentivity commited on
Commit
5c05c21
·
verified ·
1 Parent(s): 1831c48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -3,6 +3,7 @@ import requests
3
  import torch
4
  import torch.nn as nn
5
  import re
 
6
  from transformers import AutoTokenizer
7
 
8
  MODEL = "cardiffnlp/xlm-twitter-politics-sentiment"
@@ -50,7 +51,7 @@ def predict_sentiment(text):
50
  return score
51
 
52
  def fetch_articles(ticker):
53
- POLYGON_API_KEY = "cMCv7jipVvV4qLBikgzllNmW_isiODRR"
54
  url = f"https://api.polygon.io/v2/reference/news?ticker={ticker}&limit=1&apiKey={POLYGON_API_KEY}"
55
  try:
56
  response = requests.get(url)
 
3
  import torch
4
  import torch.nn as nn
5
  import re
6
+ import os
7
  from transformers import AutoTokenizer
8
 
9
  MODEL = "cardiffnlp/xlm-twitter-politics-sentiment"
 
51
  return score
52
 
53
  def fetch_articles(ticker):
54
+ POLYGON_API_KEY = os.get_env('poly_api')
55
  url = f"https://api.polygon.io/v2/reference/news?ticker={ticker}&limit=1&apiKey={POLYGON_API_KEY}"
56
  try:
57
  response = requests.get(url)