Update main.py
Browse files
main.py
CHANGED
@@ -8,13 +8,21 @@ import re
|
|
8 |
import numpy as np
|
9 |
import pandas as pd
|
10 |
from collections import OrderedDict
|
|
|
11 |
# import requests
|
12 |
# from bs4 import BeautifulSoup
|
13 |
|
14 |
app = Flask(__name__)
|
15 |
|
|
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
API_URL = "https://api-inference.huggingface.co/models/ProsusAI/finbert"
|
19 |
def query(payload):
|
20 |
response = requests.post(API_URL, headers=headers, json=payload)
|
|
|
8 |
import numpy as np
|
9 |
import pandas as pd
|
10 |
from collections import OrderedDict
|
11 |
+
import os
|
12 |
# import requests
|
13 |
# from bs4 import BeautifulSoup
|
14 |
|
15 |
app = Flask(__name__)
|
16 |
|
17 |
+
import os
|
18 |
|
19 |
+
# Replace 'YOUR_API_KEY' with your actual API key
|
20 |
+
os.environ['API_KEY'] = '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'
|
21 |
+
|
22 |
+
# Use os.getenv('API_KEY') to access the value
|
23 |
+
api_key = os.getenv('API_KEY')
|
24 |
+
|
25 |
+
headers = {"Authorization": f"Bearer {api_key}"}
|
26 |
API_URL = "https://api-inference.huggingface.co/models/ProsusAI/finbert"
|
27 |
def query(payload):
|
28 |
response = requests.post(API_URL, headers=headers, json=payload)
|