Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
boyd-nguyen committed Mar 27, 2024
1 parent 12d5821 commit 8984183
Show file tree
Hide file tree
Showing 15 changed files with 113 additions and 6 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm>=6.2"]

requires = ["setuptools >= 61.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.isort]
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ classifiers =

[options]
package_dir =
= youscribe
= src
packages = find:
python_requires = >=3.10
install_requires =
Expand All @@ -23,4 +23,4 @@ install_requires =
include_package_data = True

[options.packages.find]
where = youscribe
where = src
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

here = pathlib.Path(__file__).parent.resolve()

__version__ = "0.0.2"
__version__ = "0.0.3"

# Get the long description from the README file
long_description = (here / "README.md").read_text(encoding="utf-8")
Expand All @@ -23,7 +23,7 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
packages=find_packages(where="youscribe"),
packages=find_packages(where="src"),
install_requires=[
"faster-whisper >= 0.10.0",
"beautifulsoup4 >= 4.12.2",
Expand Down
84 changes: 84 additions & 0 deletions src/youscribe.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
Metadata-Version: 2.1
Name: youscribe
Version: 0.0.2
Summary: Library to transcribe YouTube videos using Whisper model
Author: Digital Observatory
Author-email: [email protected]
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: faster-whisper>=0.10.0
Requires-Dist: beautifulsoup4>=4.12.2
Requires-Dist: requests>=2.31.0
Requires-Dist: yt-dlp>=2024.03.10

# Transcribe YouTube videos using Whisper models

Adopts [faster_whisperer](https://github.com/SYSTRAN/faster-whisper), a cTransformer's based model for faster transcription.

## Usage

```python
from youtescribe import transcribe

transcript = transcribe(url="https://www.youtube.com/watch?v=9bZkp7q19f0")

transcript.text()
```

### Prompting

By default, the video title and description are used as prompts to the transcription model. But you can also specify your own prompt:

```python
transcript = transcribe(
url="https://www.youtube.com/watch?v=9bZkp7q19f0",
prompt="Enter prompt here"
)
```

You can also choose not to include prompt by setting `prompt=False`.

```python
transcript = transcribe(
url="https://www.youtube.com/watch?v=9bZkp7q19f0",
prompt=False
)
```

### Working with `WhisperTranscript` objects

The `transcribe()` function, if executed successfully, will return a `WhisperTranscript` object. You can view the transcript as plain text, SRT-formatted text, or a Python dictionary.

```python
transcript = transcribe(
url="https://www.youtube.com/watch?v=9bZkp7q19f0",
prompt=False
)

transcript.text()
transcript.srt()
transcript.json()
transcript.segment
```

### Customise Whisper model

In the transcribe function, you can pass your own custom Whisper model:

```python
from youtescribe import WhisperTranscriber
from youtescribe import models

custom_transcriber = WhisperTranscriber(model_size = models.TINY_EN, cpu_threads=6, device="auto")

transcript = transcribe(
url="https://www.youtube.com/watch?v=9bZkp7q19f0",
transcriber=custom_transcriber
)
transcript.text()
```


18 changes: 18 additions & 0 deletions src/youscribe.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.gitignore
README.md
pyproject.toml
setup.cfg
setup.py
test_youscribe.py
src/youscribe/__init__.py
src/youscribe/_version.py
src/youscribe/main.py
src/youscribe/models.py
src/youscribe/scraper.py
src/youscribe/transcriber.py
src/youscribe/transcript.py
src/youscribe.egg-info/PKG-INFO
src/youscribe.egg-info/SOURCES.txt
src/youscribe.egg-info/dependency_links.txt
src/youscribe.egg-info/requires.txt
src/youscribe.egg-info/top_level.txt
1 change: 1 addition & 0 deletions src/youscribe.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

4 changes: 4 additions & 0 deletions src/youscribe.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
faster-whisper>=0.10.0
beautifulsoup4>=4.12.2
requests>=2.31.0
yt-dlp>=2024.03.10
1 change: 1 addition & 0 deletions src/youscribe.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
youscribe
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8984183

Please sign in to comment.