{"id":21740727,"url":"https://github.com/murphyadam/flask-ai","last_synced_at":"2026-04-16T12:04:34.463Z","repository":{"id":245279288,"uuid":"817747427","full_name":"MurphyAdam/flask-ai","owner":"MurphyAdam","description":"A small tool API exposing an endpoint which attempts to provide sentiment analysis of input text.","archived":false,"fork":false,"pushed_at":"2024-06-20T15:26:19.000Z","size":4509,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-09T04:19:12.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PureBasic","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/MurphyAdam.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}},"created_at":"2024-06-20T11:04:05.000Z","updated_at":"2024-06-20T15:26:22.000Z","dependencies_parsed_at":"2024-06-21T04:35:36.850Z","dependency_job_id":null,"html_url":"https://github.com/MurphyAdam/flask-ai","commit_stats":null,"previous_names":["murphyadam/flask-ai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MurphyAdam/flask-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MurphyAdam%2Fflask-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MurphyAdam%2Fflask-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MurphyAdam%2Fflask-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MurphyAdam%2Fflask-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MurphyAdam","download_url":"https://codeload.github.com/MurphyAdam/flask-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MurphyAdam%2Fflask-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31884929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T11:36:10.202Z","status":"ssl_error","status_checked_at":"2026-04-16T11:36:09.652Z","response_time":69,"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":[],"created_at":"2024-11-26T06:15:04.487Z","updated_at":"2026-04-16T12:04:34.446Z","avatar_url":"https://github.com/MurphyAdam.png","language":"PureBasic","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Flask-AI\nSimple Flask app exposing endpoint for sentiment analysis of text.\nThe model is trained on [IMDB reviews](https://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz) with Tensorflow/Keras\nDataset of 20k reviews for training, and 5k for validation.\n\nAn input is condidered positive if it has a score of \u003e 0.65 \n\n### Install\nYou need Python and PIP installed.\nCreate an env var and activate it, then install the requirements.txt\n\n```sh\nvirtualenv venv\nsource venv/bin/activate   \npip install -r requirements.txt \n```\n### Run\n```sh\npython wsgi.py\n```\nor\n```sh\ngunicorn wsgi:app --bind 127.0.0.1:8001\n```\n\n### API\nOnce you start the server with either commands above, head to `127.0.0.1:8001` in your browser and test the app.\nThe `/api/predict` returns an object in the structure:\n\n```json\n{\n  \"sentiment\": \"positive\",\n  \"text\": \"This is very nice\",\n  \"weight\": 0.711793839931488\n}\n```\n\n### Deployment\nThis is deployed to Heroku with the trained model under `sentiment_model` directory.\n\n### Live URL\n`https://flask-ai-5fdcbdbfb317.herokuapp.com/`\n\n### Issues faced\n. Needed to experiment with the parameters of the model to get an okayish prediction score.\n\n. Longer texts are not classified well.\n\n. Heroku slug limit of 500mb on deployment reached bacuse of tensorflow's size. Used tensorflow CPU for deployment.\n\n### Examples:\n\n```\n[0.50000393]: Text: very bad, Sentiment: negative\n[0.7262488 ]: Text: i love it, Sentiment: positive\n[0.5       ]: Text: waste of time, Sentiment: negative\n[0.5       ]: Text: awful movie, Sentiment: negative\n[0.7310585 ]: Text: amazing movie, Sentiment: positive\n[0.5499662 ]: Text: I wish I never gave it a try, Sentiment: negative\n[0.5000005 ]: Text: bad, Sentiment: negative\n[0.73024505]: Text: good, Sentiment: positive\n[0.7245549 ]: Text: not my cup of tea, Sentiment: positive\n[0.50032616]: Text: could have been better, Sentiment: negative\n[0.5004509 ]: Text: I want my money back, Sentiment: negative\n[0.7310581 ]: Text: i enjoyed it, Sentiment: positive\n[0.73105764]: Text: great time, Sentiment: positive\n[0.50021017]: Text: I find it boring, Sentiment: negative\n[0.73105836]: Text: the settings were amazing, the story as well, Sentiment: positive\n[0.50218534]: Text: the actor was not that good, Sentiment: negative\n[0.7041709 ]: Text: nicest movie of the year, Sentiment: positive\n[0.5       ]: Text: dont waste your time with this, Sentiment: negative\n[0.52289206]: Text: I just hate it, Sentiment: negative\n[0.5000406 ]: Text: it's okay, Sentiment: negative\n[0.7277739 ]: Text: it's fine, Sentiment: positive\n[0.50000393]: Text: very bad, Sentiment: negative\n[0.67680097]: Text: mild, not good, not bad, Sentiment: positive\n```\n\n### Model train\nTo train the model on your machine, please cd into the directory `model-trainer` and install the requirments.txt.*1\nAfter that, run `python imdb_model.py`.\n\n1*: please notice this has an exhaustive list of the packages that you may not need exactly. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurphyadam%2Fflask-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmurphyadam%2Fflask-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurphyadam%2Fflask-ai/lists"}