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