-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from zaai-ai/seamless
- Loading branch information
Showing
4 changed files
with
420 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Seamless | ||
|
||
**Steps to run the code:** | ||
1. Create a virtual environment with python 3.10.13 | ||
`conda create --name myenv python=3.10.13` | ||
3. Activate in your new virtual environment | ||
`conda activate myenv` | ||
4. Install the required requirements | ||
`pip install -r requirements.txt` | ||
5. Create a folder called `/data` under `seamless/` and add your video | ||
6. Run the notebook | ||
|
||
## Folder Structure: | ||
------------ | ||
|
||
├── seamless | ||
│ | ||
├──────── data <- videos and audios | ||
│ | ||
│──── requirements.txt <- package version for installing | ||
│ | ||
│──── utils.py <- helper functions | ||
└──── seamless.ipynb <- notebook to run the code | ||
-------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
moviepy==1.0.3 | ||
jupyterlab==4.0.8 | ||
git+https://github.com/huggingface/transformers | ||
sentencepiece==0.1.99 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os | ||
from typing import Optional | ||
|
||
import moviepy.editor as mp | ||
|
||
|
||
def convert_to_wav(input_file: str, output_file: Optional[str] = None) -> None: | ||
""" | ||
Converts an audio file to WAV format using FFmpeg. | ||
Args: | ||
input_file (str): The path of the input audio file to convert. | ||
output_file (str): The path of the output WAV file. If None, the output file will be created by replacing the input file | ||
extension with ".wav". | ||
Returns: | ||
None | ||
""" | ||
if not output_file: | ||
output_file = os.path.splitext(input_file)[0] + ".wav" | ||
|
||
clip = mp.VideoFileClip(input_file) | ||
clip.audio.write_audiofile(output_file, codec="pcm_s16le") |