Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
OSDG_API_URL=http://20.73.166.85/label_text
AURORA_API_URL=https://aurora-sdg.labs.vu.nl/classifier/classify/elsevier-sdg-multi
OSDG_TOKEN=
GITHUB_TOKEN=
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ cd backend
python3 -m venv myvenv
source ./myvenv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# Update values if needed before starting backend
python3 app.py
```

Expand Down
6 changes: 5 additions & 1 deletion backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
from embedding_url import main as classify_url
from aurora_api import main as aurora_classify

OSDG_API_URL = os.environ.get(
"OSDG_API_URL",
"http://20.73.166.85/label_text"
)

app = Flask(__name__)
CORS(app)
Expand Down Expand Up @@ -175,7 +179,7 @@ def osdg_external_api():
# Call the external OSDG API
try:
osdg_response = requests.post(
"http://20.73.166.85/label_text",
OSDG_API_URL,
json={
"text": projectDescription
},
Expand Down
6 changes: 5 additions & 1 deletion backend/aurora_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import requests
import os
import json
from sdg_constants import SDG_LABELS_DICT as SDG_LABELS

Expand All @@ -16,7 +17,10 @@ def main(text: str, project_name: str = None, project_url: str = None):
Dictionary with predictions in standardized format
"""
try:
url = "https://aurora-sdg.labs.vu.nl/classifier/classify/elsevier-sdg-multi"
url = os.environ.get(
"AURORA_API_URL",
"https://aurora-sdg.labs.vu.nl/classifier/classify/elsevier-sdg-multi"
)
payload = json.dumps({"text": text})
headers = {'Content-Type': 'application/json'}
response = requests.request("POST", url, headers=headers, data=payload)
Expand Down