Skip to content

Commit

Permalink
docs,fix: fix examples and lock moviepy version for now (#24)
Browse files Browse the repository at this point in the history
* feat: add tables extension to markdown configuration

* fix: pin moviepy version to 2.0.0.dev2 and update package version to 0.1.0rc6

* docs: update installation instructions and add additional dependencies section
  • Loading branch information
leodiegues authored Dec 3, 2024
1 parent 671279e commit 82ff165
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 7 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ Mosaico is a Python library for programmatically creating and managing video com
pip install mosaico
```

To install script generator, speech synthesizer or audio transcriber dependencies, use:

```bash
pip install "mosaico[news]"
```

For additional dependencies, see the [additional dependencies](https://folhasp.github.io/mosaico/installation#additional-dependencies) section in the documentation.

## Features

- AI-powered script generation for videos
Expand All @@ -28,13 +36,21 @@ pip install mosaico
Easily create and render a video project from a script generator:

```python
import os

from mosaico.audio_transcribers.assemblyai import AssemblyAIAudioTranscriber
from mosaico.script_generators.news import NewsVideoScriptGenerator
from mosaico.speech_synthesizers.elevenlabs import ElevenLabsSpeechSynthesizer
from mosaico.video.project import VideoProject
from mosaico.video.rendering import render_video


# Set your API keys
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY")
ASSEMBLYAI_API_KEY = os.getenv("ASSEMBLYAI_API_KEY")
ELEVENLABS_API_KEY = os.getenv("ELEVENLABS_API_KEY")


# Import your media
media = [
Media.from_path("background.jpg", metadata={"description": "Background image"}),
Expand All @@ -51,6 +67,7 @@ script_generator = NewsVideoScriptGenerator(
context=context,
language="pt",
num_paragraphs=8,
api_key=ANTHROPIC_API_KEY,
)

# Create speech synthesizer
Expand All @@ -59,10 +76,11 @@ speech_synthesizer = ElevenLabsSpeechSynthesizer(
voice_stability=0.8,
voice_similarity_boost=0.75,
voice_speaker_boost=False,
api_key=ELEVENLABS_API_KEY,
)

# Create audio transcriber for captions
audio_transcriber = AssemblyAIAudioTranscriber()
audio_transcriber = AssemblyAIAudioTranscriber(api_key=ASSEMBLYAI_API_KEY)

# Create project
project = (
Expand All @@ -75,7 +93,7 @@ project = (
)

# Render project
render_video(project, "My-Breaking-News-Video.mp4")
render_video(project, "path/to/dir")
```

Or create a video project from scratch:
Expand Down Expand Up @@ -122,7 +140,7 @@ project = (
)

# Render project
render_video(project, "My-Breaking-News-Video.mp4")
render_video(project, "path/to/dir")
```

## Cookbook
Expand Down
25 changes: 25 additions & 0 deletions docs/getting-started/installation.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,28 @@ git clone https://github.com/folhalab/mosaico.git
cd mosaico
pip install -e .
```

### Additional Dependencies

To install optional dependencies for __Mosaico__, use the following command, replacing `news` with the desired feature or concatenating multiple features separated by commas:

=== "Single feature"

```bash
pip install "mosaico[news]"
```

=== "Multiple features"

```bash
pip install "mosaico[news,elevenlabs,assemblyai]"
```

Available features and their dependencies are listed below:

| Feature | Component | Dependencies | Description |
|-------------- |--------------------------------------- |------------------------- |--------------------------------------------------------------------------- |
| `news` | script generator | `litellm`, `instructor` | AI-powered script generation for videos |
| `openai` | speech synthesizer, audio transcriber | `openai` | Text-to-speech synthesis and audio transcription integrations with OpenAI |
| `elevenlabs` | speech synthesizer | `elevenlabs` | Text-to-speech synthesis integration with ElevenLabs |
| `assemblyai` | audio transcriber | `assemblyai` | Audio transcription integration with AssemblyAI |
25 changes: 25 additions & 0 deletions docs/getting-started/installation.pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,28 @@ git clone https://github.com/folhalab/mosaico.git
cd mosaico
pip install -e .
```

### Dependências Adicionais

Para instalar dependências opcionais para o __Mosaico__, use o seguinte comando, substituindo `news` pelo recurso desejado ou concatenando múltiplos recursos separados por vírgulas:

=== "Recurso único"

```bash
pip install "mosaico[news]"
```

=== "Múltiplos recursos"

```bash
pip install "mosaico[news,elevenlabs,assemblyai]"
```

Os recursos disponíveis e suas dependências estão listados abaixo:

| Recurso | Componente | Dependências | Descrição |
|------------- |--------------------------------------- |----------------------- |--------------------------------------------------------------------------- |
| `news` | gerador de script | `litellm`, `instructor` | Geração de scripts para vídeos baseada em IA |
| `openai` | sintetizador de fala, transcritor de áudio | `openai` | Integrações de síntese de texto para fala e transcrição de áudio com OpenAI |
| `elevenlabs` | sintetizador de fala | `elevenlabs` | Integração de síntese de texto para fala com ElevenLabs |
| `assemblyai` | transcritor de áudio | `assemblyai` | Integração de transcrição de áudio com AssemblyAI |
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ markdown_extensions:
- admonition
- attr_list
- md_in_html
- tables

extra:
generator: false
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
dependencies = [
"pydantic",
"pyyaml",
"moviepy>=2.0.0.dev2",
"moviepy==2.0.0.dev2",
"opencv-python>=4.10.0.84",
"findsystemfontsfilename>=0.3.0",
"pydub>=0.25.1",
Expand All @@ -41,9 +41,10 @@ mosaico = "mosaico.cli:entrypoint"
[project.optional-dependencies]
cli = ["click>=8.1.7"]
assemblyai = ["assemblyai>=0.34.0"]
elevenlabs = ["elevenlabs>=1.9.0"]
openai = ["openai>=1.54.4"]
langchain = ["langchain>=0.3.7"]
haystack = ["haystack-ai>=2.6.1"]
elevenlabs = ["elevenlabs>=1.9.0"]
news = ["instructor>=1.6.4", "litellm>=1.52.9"]

[build-system]
Expand Down
8 changes: 6 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 82ff165

Please sign in to comment.