Update main.py
Browse files
main.py
CHANGED
@@ -16,16 +16,17 @@ app = Flask(__name__)
|
|
16 |
|
17 |
import os
|
18 |
|
19 |
-
|
20 |
-
os.environ['
|
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(
|
29 |
return response.json()
|
30 |
|
31 |
|
|
|
16 |
|
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 |
+
# API_URL = "https://api-inference.huggingface.co/models/ProsusAI/finbert"
|
28 |
def query(payload):
|
29 |
+
response = requests.post(api_url, headers=headers, json=payload)
|
30 |
return response.json()
|
31 |
|
32 |
|