{"id":13341845,"url":"https://github.com/carloscdias/whisper-cpp-python","last_synced_at":"2025-07-30T16:02:15.399Z","repository":{"id":163104851,"uuid":"637485330","full_name":"carloscdias/whisper-cpp-python","owner":"carloscdias","description":"whisper.cpp bindings for python","archived":false,"fork":false,"pushed_at":"2023-08-24T15:14:37.000Z","size":81,"stargazers_count":89,"open_issues_count":14,"forks_count":23,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-11T22:34:25.850Z","etag":null,"topics":["python","python3","whisper","whisper-api","whisper-cpp"],"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/carloscdias.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}},"created_at":"2023-05-07T17:42:43.000Z","updated_at":"2025-03-09T16:33:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f0f1702-ff9d-48a6-bedb-91bd2ee51e18","html_url":"https://github.com/carloscdias/whisper-cpp-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/carloscdias/whisper-cpp-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloscdias%2Fwhisper-cpp-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloscdias%2Fwhisper-cpp-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloscdias%2Fwhisper-cpp-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloscdias%2Fwhisper-cpp-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carloscdias","download_url":"https://codeload.github.com/carloscdias/whisper-cpp-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloscdias%2Fwhisper-cpp-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267894692,"owners_count":24162030,"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-07-30T02:00:09.044Z","response_time":70,"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":["python","python3","whisper","whisper-api","whisper-cpp"],"created_at":"2024-07-29T19:26:40.333Z","updated_at":"2025-07-30T16:02:15.299Z","avatar_url":"https://github.com/carloscdias.png","language":"Python","readme":"# whisper-cpp-python\n\n![GitHub Workflow Status (with branch)](https://img.shields.io/github/actions/workflow/status/carloscdias/whisper-cpp-python/build_and_publish.yml)\n![GitHub](https://img.shields.io/github/license/carloscdias/whisper-cpp-python)\n![PyPI](https://img.shields.io/pypi/v/whisper-cpp-python)\n\nwhisper-cpp-python is a Python module inspired by [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) that provides a Python interface to the [whisper.cpp](https://github.com/ggerganov/whisper.cpp) model.\nThis module automatically parses the C++ header file of the project during building time, generating the corresponding Python bindings.\n\n## Installation\n\nTo install the module, you can use pip:\n\n```bash\npip install whisper-cpp-python\n```\n\n## Usage\n\nTo use the module, you need to create an instance of the `Whisper` class, passing the path to the model file as a parameter. Then, you can call the `transcribe` or `translate` method to transcribe or translate a given audio file.\n\n### High-level API\n\nThe high-level API provides a simple managed interface through the `Wisper` class.\n\nBelow is a short example demonstrating how to use the high-level API to transcribe an mp3:\n\n```python\n\u003e\u003e\u003e from whisper_cpp_python import Whisper\n\u003e\u003e\u003e whisper = Whisper(model_path=\"./models/ggml-tiny.bin\")\n\u003e\u003e\u003e output = whisper.transcribe(open('samples/jfk.mp3'))\n\u003e\u003e\u003e print(output)\n{'text': 'And so my fellow Americans ask not what your country can do for you, ask what you can do for your country.'}\n\u003e\u003e\u003e output = whisper.transcribe(open('samples/jfk.mp3'), response_format='verbose_json')\n\u003e\u003e\u003e print(output)\n{\n    'task': 'transcribe',\n    'language': 'en',\n    'duration': 11.0,\n    'text': 'And so, my fellow Americans ask not what your country can do for you, ask what you can do for your country.',\n    'segments': [{\n        'id': 0,\n        'seek': 0.0,\n        'start': 0.0,\n        'end': 10.98,\n        'text': ' And so, my fellow Americans ask not what your country can do for you, ask what you can do for your country.',\n        'tokens': [50364,\n            400,\n            370,\n            11,\n            452,\n            7177,\n            6280,\n            1029,\n            406,\n            437,\n            428,\n            1941,\n            393,\n            360,\n            337,\n            291,\n            11,\n            1029,\n            437,\n            291,\n            393,\n            360,\n            337,\n            428,\n            1941,\n            13,\n            50913],\n       'temperature': 0.800000011920929,\n       'avg_logprob': -0.3063158459133572,\n       'compression_ratio': 2.4000000953674316,\n       'no_speech_prob': 0.0,\n       'transient': False\n   }]\n}\n```\n\n### Low-level API\n\nAll interfaces provided by `whisper.h` are available in python. The following example\nshow how to pass a custom `progress_callback` function to the model.\n\n```python\nfrom whisper_cpp_python import Whisper\nfrom whisper_cpp_python.whisper_cpp import whisper_progress_callback\n\ndef callback(ctx, state, i, p):\n    print(i)\n\nmodel = Whisper('../quantized_models/whisper/models/ggml-tiny.bin')\nmodel.params.progress_callback = whisper_progress_callback(callback)\n\nprint(model.transcribe('vendor/whisper.cpp/samples/jfk.wav'))\n```\n\n## Web Server\n\n`whisper-cpp-python` offers a web server which aims to act as a drop-in replacement for the OpenAI API.\nThis allows you to use whisper.cpp compatible models with any OpenAI compatible client (language libraries, services, etc).\n\nTo install the server package and get started:\n\n```bash\npip install whisper-cpp-python[server]\npython3 -m whisper_cpp_python.server --model models/ggml-tiny.bin\n```\n\nNavigate to [http://localhost:8001/docs](http://localhost:8001/docs) to see the OpenAPI documentation.\n\n\n## License\n\nwhisper-cpp-python is released under the MIT License. See [LICENSE](LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarloscdias%2Fwhisper-cpp-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarloscdias%2Fwhisper-cpp-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarloscdias%2Fwhisper-cpp-python/lists"}