{"id":20302885,"url":"https://github.com/fahadulshadhin/sentiment_analysis_api","last_synced_at":"2025-08-11T17:08:07.118Z","repository":{"id":175857722,"uuid":"654584765","full_name":"FahadulShadhin/sentiment_analysis_api","owner":"FahadulShadhin","description":"Sentiment Analysis API","archived":false,"fork":false,"pushed_at":"2023-06-21T16:59:37.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-22T22:37:42.405Z","etag":null,"topics":["django","django-rest-framework","python-3"],"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/FahadulShadhin.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":"2023-06-16T12:59:40.000Z","updated_at":"2023-06-17T11:46:50.000Z","dependencies_parsed_at":"2023-06-28T23:16:32.417Z","dependency_job_id":null,"html_url":"https://github.com/FahadulShadhin/sentiment_analysis_api","commit_stats":null,"previous_names":["fahadulshadhin/sentiment_analysis_api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FahadulShadhin/sentiment_analysis_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FahadulShadhin%2Fsentiment_analysis_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FahadulShadhin%2Fsentiment_analysis_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FahadulShadhin%2Fsentiment_analysis_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FahadulShadhin%2Fsentiment_analysis_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FahadulShadhin","download_url":"https://codeload.github.com/FahadulShadhin/sentiment_analysis_api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FahadulShadhin%2Fsentiment_analysis_api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269922906,"owners_count":24496999,"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-11T02:00:10.019Z","response_time":75,"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":["django","django-rest-framework","python-3"],"created_at":"2024-11-14T16:34:32.932Z","updated_at":"2025-08-11T17:08:07.086Z","avatar_url":"https://github.com/FahadulShadhin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sentiment Analysis API\n\nThis API accepts a text input and returns the sentiment analysis result using a pre-trained ML model.\n\n## Used Pre Trained Model:\n\n[https://huggingface.co/finiteautomata/bertweet-base-sentiment-analysis](https://huggingface.co/finiteautomata/bertweet-base-sentiment-analysis)\n\n### Installation:\n\n- Transformers:\n\n```bash\npip install transformers\n```\n\n- Transformers and Pytorch:\n\n```bash\npip install 'transformers[torch]'\n```\n\n- Transformers and Flax:\n\n```bash\npip install 'transformers[flax]'\n```\n\n### Usage:\n\n```Python\nfrom transformers import pipeline\n\nmodel = pipeline(\"sentiment-analysis\", model=\"finiteautomata/bertweet-base-sentiment-analysis\")\npred = model('I am happy today!')\n```\n\n```Python\nprint(pred)\n\u003e\u003e [{'label': 'POS','score': 0.99250328540802}]\n```\n\n---\n\n## Endpoint:\n\n| Method | URL            | Description                                                                  |\n| :----- | :------------- | :--------------------------------------------------------------------------- |\n| POST   | `/api/analyze` | Return the sentiment result of the request text as positive/neutral/negative |\n\n## Example:\n\n### Request:\n\n```json\n{\n\t\"text\": \"I am so happy!\"\n}\n```\n\n### Response:\n\n```json\n{\n\t\"status\": \"success\",\n\t\"data\": {\n\t\t\"text\": \"I am so happy!\",\n\t\t\"sentiment\": \"positive\"\n\t}\n}\n```\n\n## Project Setup:\n\n### Install Dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\n### Make Migrations:\n\n```bash\npython manage.py makemigrations\n```\n\n```bash\npython manage.py migrate\n```\n\n### Run server:\n\n```bash\npython manage.py runserver\n```\n\n### Test the API:\n\n```\nhttp://127.0.0.1:8000/api/analyze/\n```\n\n## Project Structure:\n\n```\n.\n├── api                 # main app for sentiment API\n│   ├── __init__.py\n│   ├── admin.py\n│   ├── apps.py\n│   ├── models.py\n│   ├── serializers.py\n│   ├── tests.py\n│   ├── urls.py\n│   ├── utils.py        # pre-trained model used here\n│   └── views.py\n├── manage.py\n└── sentiment_analysis  # root directory of the project\n    ├── __init__.py\n    ├── asgi.py\n    ├── settings.py\n    ├── urls.py\n    └── wsgi.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffahadulshadhin%2Fsentiment_analysis_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffahadulshadhin%2Fsentiment_analysis_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffahadulshadhin%2Fsentiment_analysis_api/lists"}