Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker version / pre-built image added #2

Merged
merged 4 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .streamlit/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[browser]
gatherUsageStats = false
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y \
python3 \
python3-pip \
python3-dev \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*

RUN python3 --version && pip3 --version
RUN ffmpeg -version

ENV PYTHONPATH=.
ENV GRADIO_SERVER_PORT=8501
ENV GRADIO_SERVER_NAME="0.0.0.0"

WORKDIR /home

COPY requirements.gradio .

RUN pip3 install --no-cache-dir -r requirements.gradio
COPY bleep_that_sht /home/bleep_that_sht

ENTRYPOINT ["python3", "/home/bleep_that_sht/gradio_app_url_download.py"]
44 changes: 24 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
<a href="https://huggingface.co/spaces/neonwatty/bleep_that_sht" target="_parent"><img src="https://img.shields.io/badge/🤗-HuggingFace%20Space-cyan.svg" alt="HuggingFace Space"/></a>
<a href="https://colab.research.google.com/github/jermwatt/bleep_that_sht/blob/main/beep_that_sht_walkthrough.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <a href="https://www.youtube.com/watch?v=U8Ki9dD3HF0" target="_parent"><img src="https://badges.aleen42.com/src/youtube.svg" alt="Youtube"/></a>
<a href="https://colab.research.google.com/github/jermwatt/bleep_that_sht/blob/main/beep_that_sht_walkthrough.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <a href="https://www.youtube.com/watch?v=U8Ki9dD3HF0" target="_parent"><img src="https://badges.aleen42.com/src/youtube.svg" alt="Youtube"/></a>
[![Python application](https://github.com/neonwatty/bleep_that_sht/actions/workflows/python-app.yml/badge.svg)](https://github.com/neonwatty/bleep_that_sht/actions/workflows/python-app.yml/python-app.yml) <a href="https://www.producthunt.com/posts/bleep-that-sh-t?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-bleep&#0045;that&#0045;sh&#0045;t" target="_parent"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=470378&theme=light" alt="Bleep&#0032;That&#0032;Sh&#0042;t&#0033; - A&#0032;whisper&#0032;app&#0032;that&#0032;bleeps&#0032;out&#0032;chosen&#0032;words&#0032;in&#0032;YouTube&#0032;videos | Product Hunt" style="width: 250px; height: 45px;" /></a>


# bleep that sh*t
# bleep that sh\*t

Make anyone sound naughty / funny with Python.

Bleep out keywords of your choice from an mp4 by leveraging a transcription model (here Whisper) to transcribe the audio, then target and replace chosen words with *bleep* sounds using the extracted timestamps associated with your chosen word(s).
Bleep out keywords of your choice from an mp4 by leveraging a transcription model (here Whisper) to transcribe the audio, then target and replace chosen words with _bleep_ sounds using the extracted timestamps associated with your chosen word(s).

All processing is performed locally.

- [Version overall comparison](#version-overall-comparison)

- [Examples](#examples)
- [Installation](#installation)
- [For local videos](#for-local-videos)
- [For Youtube videos](#for-youtube-videos)
- [Walkthrough](#walkthrough)

All processing is performed locally - see the streamlit app (setup below) and detailed walkthrough notebook (see `beep_that_sht_walkthrough.ipynb`) to play / see nitty gritty details. Click [![HuggingFace Space](https://img.shields.io/badge/🤗-HuggingFace%20Space-cyan.svg)](https://huggingface.co/spaces/neonwatty/bleep_that_sht) to try out this toy app directly in your browser. WARNING: the machine this Space is running on is pretty small - so use it to try out shorter (<2min) videos.
## Examples

Some examples of the end product (make sure to turn volume on, its off by default).

https://github.com/user-attachments/assets/da50f8a9-27ba-4747-92e0-72a25e65175c

Let's look more closely at the last example above - below is a short clip we'll bleep out some words from using the pipeline in this repo. (make sure to turn on audio - its off by default)
Let's look more closely at the last example above - below is a short clip we'll bleep out some words from using the pipeline in this repo. (make sure to turn on audio - its off by default)

https://github.com/neonwatty/bleep_that_sht/assets/16326421/fb8568fe-aba0-49e2-a563-642d658c0651


Now the same clip with the words - "treetz", "ice", "cream", "chocolate", "syrup", and "cookie" - bleeped out


https://github.com/neonwatty/bleep_that_sht/assets/16326421/63ebd7a0-46f6-4efd-80ea-20512ff427c0

## Installation

## Install instructions
### For local videos

To get setup to run the notebook / bleep your own videos / run the strealit demo first install the requirements for this project by pasting the below in your terminal.

Expand All @@ -42,9 +50,7 @@ pip install -r requirements.gradio

You will need [ffmpeg](https://www.ffmpeg.org/download.html) installed on your machine as well.



## Instructions for bleeping **youtube** videos via youtube / shorts url
### For Youtube videos

Start this streamlit demo locally that lets you enter in a youtube / shorts url to a video you wish to bleep

Expand All @@ -58,14 +64,12 @@ Alternatively you can start a gradio server with the same functionality
python -m bleep_that_sht/gradio_app_url_download.py
```

This is the version hosted in the HF space [![HuggingFace Space](https://img.shields.io/badge/🤗-HuggingFace%20Space-cyan.svg)](https://huggingface.co/spaces/neonwatty/bleep_that_sht).


You can also use docker compose

## Instructions for bleeping your own **local** videos
```bash
docker compose up
```

Start this streamlit demo locally that lets you drag and drop local video files to bleep
## Walkthrough

```python
python -m streamlit run bleep_that_sht/app_video_upload.py
```
See `beep_that_sht_walkthrough.ipynb`) to play / see nitty gritty details.
2 changes: 1 addition & 1 deletion bleep_that_sht/gradio_app_url_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
model_selection = gr.Dropdown(
choices=avaliable_models,
value="base",
label="whisper model (base only in HF space)",
label="whisper model (base only in demo)",
info="whisper model selection",
interactive=False,
)
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
ytdatakit:
image: ghcr.io/neonwatty/bleep_that_sht:latest
container_name: bleep_that_sht
ports:
- 8501:8501
2 changes: 2 additions & 0 deletions requirements.gradio
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
whisper-timestamped
scipy
moviepy
yt-dlp
gradio
pydub
1 change: 1 addition & 0 deletions requirements.streamlit
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ whisper-timestamped
moviepy
yt-dlp
streamlit
pydub
Loading