{"id":19736678,"url":"https://github.com/anyesh/emotion-recognition","last_synced_at":"2025-08-16T12:07:35.370Z","repository":{"id":37214234,"uuid":"262010825","full_name":"Anyesh/emotion-recognition","owner":"Anyesh","description":"AI-based application for emotion detection and  recognition from text data","archived":false,"fork":false,"pushed_at":"2023-05-22T23:27:23.000Z","size":1894,"stargazers_count":6,"open_issues_count":7,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-13T16:06:29.653Z","etag":null,"topics":["machine-learning","nlp","nlp-machine-learning"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/Anyesh.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":"2020-05-07T09:45:00.000Z","updated_at":"2024-06-26T16:55:38.000Z","dependencies_parsed_at":"2025-05-08T22:40:08.863Z","dependency_job_id":null,"html_url":"https://github.com/Anyesh/emotion-recognition","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Anyesh/emotion-recognition","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anyesh%2Femotion-recognition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anyesh%2Femotion-recognition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anyesh%2Femotion-recognition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anyesh%2Femotion-recognition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anyesh","download_url":"https://codeload.github.com/Anyesh/emotion-recognition/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anyesh%2Femotion-recognition/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270709019,"owners_count":24631992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["machine-learning","nlp","nlp-machine-learning"],"created_at":"2024-11-12T01:08:07.444Z","updated_at":"2025-08-16T12:07:35.344Z","avatar_url":"https://github.com/Anyesh.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Emotion Detection and Recognition from Text data\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./example.png\"  /\u003e\n\u003c/p\u003e\n\n## Project Structure\n\n```\n\n├── README.md          \u003c- README file.\n├── api                \u003c- APIs to interact with the inference model.\n│   ├── example.py\n|\n├── data\n│   ├── example.csv       \u003c- raw data from third party sources.\n|\n├── docs               \u003c- Project related analysis and other documents\n│\n├── models             \u003c- Trained and serialized models/artifacts\n|   |── v1\n|       |── artifact.h5\n|   |── v2\n|       |── artifact.h5\n│\n├── notebooks          \u003c- Data analysis Jupyter notebooks\n│\n├── requirements.txt   \u003c- Pip generated requirements file for the project.\n│\n├── emotion_detection     \u003c- Source code for use in this project.\n│   ├── __init__.py\n│   │\n│   ├── config         \u003c- Contains the config files.\n│   │   └── config.py\n|   |\n│   ├── data           \u003c- Scripts to download data and store on root data path.\n│   │   └── make_dataset.py\n|   |\n│   ├── dispatcher     \u003c- Collection of various ML models ready to dispatch.\n│   │   └── dispatcher.py\n│   │\n│   ├── features       \u003c- Scripts to process the data.\n│   │   └── build_features.py\n│   │\n│   ├── models         \u003c- Scripts to train, test, and build model\n│   │   │\n│   │   ├── test_model.py\n│   │   └── train_model.py\n│   │   └── build_model.py\n|   |\n│   ├── utils          \u003c- Collection of various utility functions.\n|   |   └── example.py\n|   |\n│   ├── run_app.py      \u003c- script to run the flask web app\n│   ├── run.py          \u003c- script to run the model training\n│   ├── simple_inference.py     \u003c- script to test the model on cli\n\n```\n\n## Getting Started\n\n### Requirements\n\n```\npip install -r requirements.txt\n```\n\n## Config File\n\nConfig file at `emotion_detection/config/config.py` contains all the necessary configurations. Please make sure to check that before preoceeding.\n\n### Example:\n\n```\nimport os\n\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n\nDATA_PATH = os.path.join(BASE_DIR, \"data\", \"raw\")\n\nDATASET_NAME = \"ISEAR_dataset.csv\"\n\nDATASET_URL = \u003cdataset-url\u003e\n\nMODEL_PATH = os.path.join(BASE_DIR, \"models\")\n\nCHECKPOINT_PATH = os.path.join(BASE_DIR, \"checkpoints\")\n\n```\n\n### Dispatcher\n\nAll the available ML models should be listed in the `emotion_detection/dispatcher/dispatcher.py` file. This will be used as the `model-name` while training and testing.\n\nExample:\n\n```\nMODELS = {\n    \"randomforest\": ensemble.RandomForestClassifier,\n    \"naive_bayes\": MultinomialNB,\n    \"xgboost\": XGBClassifier,\n    \"logistic\": LogisticRegression,\n    \"sgd_classifier\": SGDClassifier,\n    \"svm_svc\": SVC,\n}\n```\n\n### Model parameters\n\nHyperparameters for the listed models are to be stored in the `emotion_detection/config/model_params.py` file with the same name as the listed models in dispatcher.\n\nExample:\n\n```\n\"bert_classifier\": {},\n\"xgboost\": {},\n\"randomforest\": {},\n\"naive_bayes\": {\"alpha\": 0.1},\n```\n\n### Download the dataset\n\nThe following command will download the dataset from the URL given in `src/config/config.py` file .\n\n```\npython -m emotion_detection.data.make_dataset\n```\n\n### Train the models\n\n```\npython run.py --model-name \u003cmodel-name\u003e --vocab-size \u003cvocab-size\u003e --train-size \u003ctrain-size\u003e\n```\n\n### Test - Simple inference\n\n```\npython simple_inference.py --model-name \u003cmodel-name\u003e\n```\n\nExample:\n\n```\npython run.py --model-name naiv_bayes --vocab-size 7000 --train-size 0.7\n```\n\n## Flask Web App\n\nTo run the Flask application in docker with MongoDB run the following command.\nConfigure the MongoDB URL and DB name at `api/config.cfg`.\n\nChange to local DB if not using docker.\n\n```\npython run_app.py\n```\n\n## Run in docker\n\n```\ndocker-compose up\n```\n\n## Try running modules seperately\n\n### Train the model\n\nThe following command will train the model by first pre-processing the dataset from the `feature_generator.py` and train on the configured ML model.\n\n```\npython -m emotion_detection.models.train_model\n```\n\n### Test the model\n\n```\npython -m emotion_detection.models.test_model\n\n```\n\n## To-do List\n\n- [x] Download dataset\n- [x] Pre-process data\n- [x] Train model\n- [x] Test model\n- [x] Main Pipeline\n- [x] Flask app\n- [ ] Clean build\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanyesh%2Femotion-recognition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanyesh%2Femotion-recognition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanyesh%2Femotion-recognition/lists"}