Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Some.
Browse files Browse the repository at this point in the history
  • Loading branch information
makseq committed Jun 12, 2019
1 parent 4200520 commit f62283e
Show file tree
Hide file tree
Showing 26 changed files with 336 additions and 197 deletions.
11 changes: 7 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
GoogleNews==1.2.0
beautifulsoup4==4.7.1
lxml==4.3.3
numpy==1.16.4
pandas==0.24.2
requests==2.22.0
html2text==2018.1.9
readability-lxml==0.7.1
pandas==0.24.2
six==1.12.0
urllib3==1.25.3
flask==1.0.3
1 change: 0 additions & 1 deletion src/__init__.py

This file was deleted.

47 changes: 47 additions & 0 deletions src/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"port": 8000,
"debug": true,

"heartex": {
"token": "<place your token here>",
"sentiment_project_id": 1
},

"logger": {
"version": 1,
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "DEBUG",
"stream": "ext://sys.stdout"
},
"file": {
"class": "logging.FileHandler",
"level": "DEBUG",
"filename": "static/logs/messages.log"
}
},
"loggers": {
"console": {
"level": "DEBUG",
"handlers": [
"console"
],
"propagate": "no"
},
"service": {
"level": "DEBUG",
"handlers": [
"file"
],
"propagate": "no"
}
},
"root": {
"level": "DEBUG",
"handlers": [
"console"
]
}
}
}
76 changes: 0 additions & 76 deletions src/get_google_news.py

This file was deleted.

73 changes: 0 additions & 73 deletions src/get_twitter_news.py

This file was deleted.

1 change: 1 addition & 0 deletions src/heartex/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import api
File renamed without changes.
28 changes: 15 additions & 13 deletions src/heartex.py → src/heartex/api.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""
""" Heartex Platform API
"""
import requests

URL = "https://go.heartex.net"


def create_project(token=None, name="Project", label_config=None):
""" Create new project on Heartex platform
"""
"""
# create a project
res = requests.post(URL + '/api/projects/', data={
"title": name,
"label_config": label_config
Expand All @@ -17,9 +16,10 @@ def create_project(token=None, name="Project", label_config=None):
})

return res.json()['id']



def upload_data(token=None, project=None, input=None):
"""
""" Upload tasks to project on Heartex platform
"""
files = {}
files[input] = open(input, 'rb')
Expand All @@ -32,8 +32,9 @@ def upload_data(token=None, project=None, input=None):

return res


def publish_project(token=None, project=None):
"""
""" Publish project to start labeling on Heartex platform
"""
res = requests.patch(URL + '/api/projects/%d/' % (project,),
data={ "is_published": True },
Expand All @@ -43,11 +44,12 @@ def publish_project(token=None, project=None):

return res

def run_predict(token=None, project=None, data=None, *args, **kwargs):
"""

def run_predict(token=None, project=None, data=None):
""" Run prediction using Heartex platform
"""
assert project is not None, 'Specify project number in heartex'
assert token is not None, 'Specify your token to heartex'
assert project is not None, 'Specify project number in Heartex'
assert token is not None, 'Specify your token to Heartex'
assert data is not None, 'Data must be set'
res = requests.post(URL + '/api/projects/%d/predict/' % (project,),
json=data,
Expand All @@ -58,9 +60,9 @@ def run_predict(token=None, project=None, data=None, *args, **kwargs):

return res

def new_project_setup(token=None, label_config=None, input=None, name=None,
*args, **kwargs):
"""

def new_project_setup(token=None, label_config=None, input=None, name=None):
""" Create new project and full setup
"""
pk = create_project(token=token, label_config=label_config, name=name)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 0 additions & 17 deletions src/requirements.txt

This file was deleted.

Loading

0 comments on commit f62283e

Please sign in to comment.