{"id":22472991,"url":"https://github.com/truefoundry/emotion-classification-fastapi","last_synced_at":"2025-09-17T21:23:56.614Z","repository":{"id":206222688,"uuid":"716119556","full_name":"truefoundry/emotion-classification-fastapi","owner":"truefoundry","description":"A FastAPI service that wraps a text classification model from Huggingface Hub. Example code to deploy a Service with Truefoundry","archived":false,"fork":false,"pushed_at":"2025-08-08T07:28:38.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-08-08T09:20:30.469Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/truefoundry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-11-08T13:36:50.000Z","updated_at":"2025-08-08T07:28:04.000Z","dependencies_parsed_at":"2024-04-10T13:27:46.409Z","dependency_job_id":"8c5835fd-2a7c-48a7-9472-76595f1b61fd","html_url":"https://github.com/truefoundry/emotion-classification-fastapi","commit_stats":null,"previous_names":["chiragjn/emotion-classification-fastapi"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/truefoundry/emotion-classification-fastapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truefoundry%2Femotion-classification-fastapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truefoundry%2Femotion-classification-fastapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truefoundry%2Femotion-classification-fastapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truefoundry%2Femotion-classification-fastapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/truefoundry","download_url":"https://codeload.github.com/truefoundry/emotion-classification-fastapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truefoundry%2Femotion-classification-fastapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275666225,"owners_count":25506162,"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-09-17T02:00:09.119Z","response_time":84,"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":[],"created_at":"2024-12-06T12:18:19.746Z","updated_at":"2025-09-17T21:23:56.596Z","avatar_url":"https://github.com/truefoundry.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"FastAPI Emotion Classification\n---\nThis example wraps an Emotion Classification model from Huggingface Hub in a FastAPI app.\n\n## Run Locally\n\n1. Install requirements\n\n```shell\npython -m pip install -r requirements.txt\n```\n\n2. Run with uvicorn\n\n```shell\nuvicorn app:app --host 0.0.0.0 --port 8000\n```\n\n## Deploy with Truefoundry\n\n1. Install `truefoundry`\n\n```shell\npython -m pip install -U truefoundry\n```\n\n2. Login\n\n```shell\ntfy login --host \u003cTruefoundry Platform URL\u003e\n```\n\n1. Add a deploy.py\n\n- Edit your `host` and optionally `path` for endpoint ([Docs](https://docs.truefoundry.com/docs/routing))\n- Edit your `workspace_fqn` ([Docs](https://docs.truefoundry.com/docs/key-concepts#get-workspace-fqn))\n\n```python\nimport argparse\n\nfrom truefoundry.deploy import (\n    Build,\n    DockerFileBuild,\n    Image,\n    LocalSource,\n    Port,\n    PythonBuild,\n    Service,\n    Resources\n)\n\nservice = Service(\n    name=\"emotion-class-svc\",\n\n    # --- Build configuration i.e. How to package and build source code ---\n\n    # This will instruct Truefoundry to automatically generate the Dockerfile and build it\n    image=Build(\n        build_source=LocalSource(local_build=False),\n        build_spec=PythonBuild(\n            python_version=\"3.10\",\n            requirements_path=\"requirements.txt\",\n            command=\"uvicorn app:app --host 0.0.0.0 --port 8000\"\n        )\n        # Alternatively, you can also use DockerFileBuild to use the written Dockerfile like follows:\n        # build_spec=DockerFileBuild()\n    ),\n    # Alternatively, you can use an already built public image of this codebase like follows:\n    # image=Image(image_uri=\"truefoundrycloud/emotion-classification-fastapi:0.0.1\")\n\n    # --- Endpoints configuration i.e. How requests will reach the container ---\n\n    ports=[\n        Port(\n            port=8000,\n            # A model endpoint looks like https://{host}/{path}\n            # Please see https://docs.truefoundry.com/docs/routing\n            host=\"\u003cEnter a host for the model endpoint\u003e\",\n            path=None # \u003cEnter optional path for model endpoint\u003e,\n        )\n    ],\n\n    # --- Environment Variables ---\n    env={},\n\n    # --- Resources ---\n    resources=Resources(\n        cpu_request=0.5,\n        cpu_limit=0.5,\n        memory_request=1000,\n        memory_limit=1000,\n        ephemeral_storage_request=500,\n        ephemeral_storage_limit=500\n    )\n)\n\n# Get your workspace fqn from https://docs.truefoundry.com/docs/workspace#copy-workspace-fqn-fully-qualified-name\nservice.deploy(workspace_fqn=\"\u003cEnter Workspace FQN\u003e\", wait=False)\n```\n\n4. Deploy!\n\n```shell\npython deploy.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruefoundry%2Femotion-classification-fastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftruefoundry%2Femotion-classification-fastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruefoundry%2Femotion-classification-fastapi/lists"}