Update main.py
Browse files
main.py
CHANGED
@@ -14,19 +14,17 @@ import os
|
|
14 |
|
15 |
app = Flask(__name__)
|
16 |
|
17 |
-
import os
|
18 |
|
19 |
|
20 |
-
# os.environ['API_URL'] = 'https://api-inference.huggingface.co/models/ProsusAI/finbert'
|
21 |
-
# API_URL = "https://api-inference.huggingface.co/models/ProsusAI/finbert"
|
22 |
|
23 |
-
api_key = os.getenv('API_KEY')
|
24 |
-
api_url = os.getenv('API_URL')
|
25 |
|
26 |
-
|
|
|
27 |
|
|
|
|
|
28 |
def query(payload):
|
29 |
-
response = requests.post(
|
30 |
return response.json()
|
31 |
|
32 |
|
|
|
14 |
|
15 |
app = Flask(__name__)
|
16 |
|
|
|
17 |
|
18 |
|
|
|
|
|
19 |
|
|
|
|
|
20 |
|
21 |
+
# api_key = os.getenv('API_KEY')
|
22 |
+
# api_url = os.getenv('API_URL')
|
23 |
|
24 |
+
headers = {"Authorization": f"Bearer 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"}
|
25 |
+
API_URL = "https://api-inference.huggingface.co/models/ProsusAI/finbert"
|
26 |
def query(payload):
|
27 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
28 |
return response.json()
|
29 |
|
30 |
|