{"id":29016839,"url":"https://github.com/daveminer/bert-serv","last_synced_at":"2026-02-17T15:02:03.711Z","repository":{"id":64921793,"uuid":"577612363","full_name":"daveminer/BERT-serv","owner":"daveminer","description":"FinBERT pre-trained models as a containerized HTTP service.","archived":false,"fork":false,"pushed_at":"2025-05-15T04:12:16.000Z","size":128,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-25T22:45:04.831Z","etag":null,"topics":["celery","django","docker-compose","finbert","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daveminer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-12-13T05:57:28.000Z","updated_at":"2025-05-15T04:12:19.000Z","dependencies_parsed_at":"2025-05-12T21:36:50.027Z","dependency_job_id":"afb3dc81-62e6-4dfc-9041-d38215c84513","html_url":"https://github.com/daveminer/BERT-serv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/daveminer/BERT-serv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daveminer%2FBERT-serv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daveminer%2FBERT-serv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daveminer%2FBERT-serv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daveminer%2FBERT-serv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daveminer","download_url":"https://codeload.github.com/daveminer/BERT-serv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daveminer%2FBERT-serv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29548201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T14:33:00.708Z","status":"ssl_error","status_checked_at":"2026-02-17T14:32:58.657Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["celery","django","docker-compose","finbert","pytorch"],"created_at":"2025-06-25T22:41:36.845Z","updated_at":"2026-02-17T15:02:03.681Z","avatar_url":"https://github.com/daveminer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"     _______  _______  ______    _______         _______  _______  ______    __   __\n    |  _    ||       ||    _ |  |       |       |       ||       ||    _ |  |  | |  |\n    | |_|   ||    ___||   | ||  |_     _| ____  |  _____||    ___||   | ||  |  |_|  |\n    |       ||   |___ |   |_||_   |   |  |____| | |_____ |   |___ |   |_||_ |       |\n    |  _   | |    ___||    __  |  |   |         |_____  ||    ___||    __  ||       |\n    | |_|   ||   |___ |   |  | |  |   |          _____| ||   |___ |   |  | | |     |\n    |_______||_______||___|  |_|  |___|         |_______||_______||___|  |_|  |___|\n\n[![BERT-serv CI](https://github.com/daveminer/BERT-serv/actions/workflows/ci.yml/badge.svg)](https://github.com/daveminer/BERT-serv/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/daveminer/BERT-serv/branch/main/graph/badge.svg?token=jMMlzwBmhi)](https://codecov.io/gh/daveminer/BERT-serv)\n\n**BERT-serv** provides [FinBERT](https://github.com/ProsusAI/finBERT) sentiment as a service. Send financial text via HTTP and get sentiment analysis back from [these pretrained models](https://github.com/yya518/FinBERT).\n\n:exclamation: Only [this sentiment model](https://huggingface.co/yiyanghkust/finbert-tone) is implemented at this time.\n\n## Why\n\n- FinBERT analysis made available on-demand to HTTP clients (no Python required!)\n- Avoid adding [PyTorch](https://pytorch.org/) dependencies to other parts of your system\n- Results are saved and can be queried\n- Analysis requests are handled asynchronously\n\n## Run the Local Demo\n\nInstall [Docker Desktop](https://www.docker.com/products/docker-desktop/) if needed.\n\n```\ngit clone https://github.com/daveminer/BERT-serv.git\ncd BERT-serv\ncp .env.dist .env\ndocker-compose up\n```\n\nBERT-serv is now running on local port 8000!\n\n## How to Use\n\n### Request sentiment analysis on text\n\nSend a POST request to the `/sentiment/new/` path. A `callback_url` may be specified in\nthe query parameters for asynchrous use cases and long-running sentiment analyses. This callback\nwill have a JSON object in the body with an array of the new sentiment record ids: `{\"ids\": [95, 96]}`\n\nThe body of the POST request must be a list of objects, each of which containes these fields:\n\n- `article_id`: An identifier for the text; this ends up on the database record as well as in the callback payload.\n- `tags`: The tags to be associated with the sentiment record;\n  useful for filtering on existing sentiment records.\n- `text`: The text to analyze\n\n```\ncurl --request POST \\\n  --url 'http://localhost:8000/sentiment/new?callback_url=http://web:8000/callback/sentiment/new/' \\\n  --header 'Content-Type: application/json' \\\n  --data '[{\"article_id\": 1, \"tags\": [\"stock\"], \"text\": \"year over year growth is increasing\"}, {\"article_id\": 2, \"tags\": [\"stock\"], \"text\": \"there is a shortage of capital, and we need extra financing\"}]'\n```\n\n##### Callback\n\nIf a callback is specified, the following payload will be sent to the callback URL:\n\n```\n{\n\t\"results\": [\n\t\t{\n\t\t\t\"article_id\": 1,\n\t\t\t\"sentiment\": {\n\t\t\t\t\"label\": \"Positive\",\n\t\t\t\t\"score\": 0.9999837875366211\n\t\t\t\t\"tags\": [\"stock\"]\n\t\t\t}\n\t\t}\n\t]\n}\n```\n\n### Look up sentiment results\n\nResponse defaults to HTML unless `application/json` is specified in the `Accept` header.\n\n##### Get last 100 sentiments\n\nMake a GET request to the `/sentiment/` path.\n\n```\ncurl --request GET \\\n  --url http://localhost:8000/sentiment/ \\\n  --header 'Accept: application/json'\n```\n\nThe output will look like this:\n\n```\n[\n\t{\n\t\t\"created_at\": \"2024-08-23T02:19:45.657\",\n\t\t\"label\": \"Negative\",\n\t\t\"score\": 0.9966173768043518,\n\t\t\"tags\": [\"stock\"],\n\t\t\"text\": \"there is a shortage of capital, and we need extra financing\"\n\t},\n\t{\n\t\t\"created_at\": \"2024-08-23T02:19:45.657\",\n\t\t\"label\": \"Positive\",\n\t\t\"score\": 0.9999837875366211,\n\t\t\"tags\": [\"stock\"],\n\t\t\"text\": \"year over year growth is increasing\"\n\t}\n]\n```\n\n##### Get a specific sentiment by index\n\nAdd the index of the sentiment resource to the `sentiment` path:\n\n```\ncurl --request GET \\\n  --url http://localhost:8000/sentiment/1/ \\\n  --header 'Accept: application/json'\n```\n\n### Filter sentiments\n\n##### By Tag\n\nA comma-separated list of tags may be specified in the `tags` query parameter.\n\n##### By Age\n\nThe `period` query parameter accepts an integer that specifies how many days back to look for sentiments.\n\n### Pagination\n\nThe sentiment index controller uses Django's built in [pagination](https://docs.djangoproject.com/en/5.0/topics/pagination/).\nThe `/sentiment/` path accepts `page_size` and a `page` query parameters.\n\n## Development Environment Setup\n\nThe `make dev-services` command will start all of the services besides the app. This allows for the app to be started and stopped (with `make app`) in the terminal for convenience during development. Note that `make dev-services` requires the Postgres database to be running. A database\ncan be started with `make db` if one isn't running already.\n\n### Setting up the environment\n\nLocal development requires that the local environment is set up alongside the containerized services. \n\n#### (If needed) Install Python (Ubuntu)\n\n```\nsudo apt install python3\n```\n\n#### (If needed) Install pip3 (Ubuntu)\n\n```\nsudo apt install python3-pip -y\n```\n\n#### (If needed) Install virtualenv\n\n```\nsudo apt-get update\nsudo apt install python3.12-venv\n```\n\n##### Create the virtualenv\n\n```\n\npython3 -m virtualenv env\n```\n\n##### Load\n\n```\npython3 -m venv .venv\n```\n\n##### Activate\n\n```\nsource .venv/bin/activate\n```\n\nNotes:\n\n- `make services` requires [Docker Desktop](https://www.docker.com/products/docker-desktop/)\n- `make deps` will install dependencies via pip3 and must be run before `make app`. This can take a few minutes as the PyTorch dependencies are sizable.\n\n## Service setup\n\nThe `docker-compose-services.yml` is intended to stand this service and dependencies up against an external Postgres instance.\n\n```\n# To run:\ndocker-compose -f docker-compose-service.yml up\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaveminer%2Fbert-serv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaveminer%2Fbert-serv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaveminer%2Fbert-serv/lists"}