mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-04-13 09:39:17 +00:00
ci: update Docker workflow to tag images as latest, enhance README with local saving instructions, and modify UI components for local saving feature
This commit is contained in:
parent
da324b0959
commit
9edc7fd7fc
5 changed files with 47 additions and 7 deletions
13
.github/workflows/docker-publish.yml
vendored
13
.github/workflows/docker-publish.yml
vendored
|
@ -2,6 +2,8 @@ name: Docker Build, Slim, and Publish
|
|||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags: [ 'v*.*.*' ]
|
||||
# Allow manual trigger from GitHub UI
|
||||
workflow_dispatch:
|
||||
|
@ -63,6 +65,10 @@ jobs:
|
|||
run: |
|
||||
docker push ${{ env.GPU_IMAGE_NAME }}:v0.1.0
|
||||
docker push ${{ env.GPU_IMAGE_NAME }}:v0.1.0-slim
|
||||
docker tag ${{ env.GPU_IMAGE_NAME }}:v0.1.0 ${{ env.GPU_IMAGE_NAME }}:latest
|
||||
docker tag ${{ env.GPU_IMAGE_NAME }}:v0.1.0-slim ${{ env.GPU_IMAGE_NAME }}:latest-slim
|
||||
docker push ${{ env.GPU_IMAGE_NAME }}:latest
|
||||
docker push ${{ env.GPU_IMAGE_NAME }}:latest-slim
|
||||
|
||||
# Build CPU version
|
||||
- name: Build CPU Docker image
|
||||
|
@ -91,8 +97,12 @@ jobs:
|
|||
run: |
|
||||
docker push ${{ env.CPU_IMAGE_NAME }}:v0.1.0
|
||||
docker push ${{ env.CPU_IMAGE_NAME }}:v0.1.0-slim
|
||||
docker tag ${{ env.CPU_IMAGE_NAME }}:v0.1.0 ${{ env.CPU_IMAGE_NAME }}:latest
|
||||
docker tag ${{ env.CPU_IMAGE_NAME }}:v0.1.0-slim ${{ env.CPU_IMAGE_NAME }}:latest-slim
|
||||
docker push ${{ env.CPU_IMAGE_NAME }}:latest
|
||||
docker push ${{ env.CPU_IMAGE_NAME }}:latest-slim
|
||||
|
||||
# Build and push UI version (unchanged)
|
||||
# Build and push UI version
|
||||
- name: Build and push UI Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
|
@ -101,6 +111,7 @@ jobs:
|
|||
push: true
|
||||
tags: |
|
||||
${{ env.UI_IMAGE_NAME }}:v0.1.0
|
||||
${{ env.UI_IMAGE_NAME }}:latest
|
||||
build-args: |
|
||||
DOCKER_BUILDKIT=1
|
||||
platforms: linux/amd64
|
||||
|
|
15
README.md
15
README.md
|
@ -182,6 +182,21 @@ If you only want the API, just comment out everything in the docker-compose.yml
|
|||
Currently, voices created via the API are accessible here, but voice combination/creation has not yet been added
|
||||
|
||||
*Note: Recent updates for streaming could lead to temporary glitches. If so, pull from the most recent stable release v0.0.2 to restore*
|
||||
|
||||
### Disabling Local Saving
|
||||
|
||||
You can disable local saving of audio files and hide the file view in the UI by setting the `DISABLE_LOCAL_SAVING` environment variable to `true`. This is useful when running the service on a server where you don't want to store generated audio files locally.
|
||||
|
||||
When using Docker Compose:
|
||||
```yaml
|
||||
environment:
|
||||
- DISABLE_LOCAL_SAVING=true
|
||||
```
|
||||
|
||||
When running the Docker image directly:
|
||||
```bash
|
||||
docker run -p 7860:7860 -e DISABLE_LOCAL_SAVING=true ghcr.io/remsky/kokoro-fastapi-ui:latest
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
|
|
@ -32,3 +32,4 @@ services:
|
|||
environment:
|
||||
- GRADIO_WATCH=1 # Enable hot reloading
|
||||
- PYTHONUNBUFFERED=1 # Ensure Python output is not buffered
|
||||
- DISABLE_LOCAL_SAVING=true # Set to 'true' to disable local saving and hide file view
|
||||
|
|
|
@ -5,30 +5,39 @@ import gradio as gr
|
|||
from .. import files
|
||||
|
||||
|
||||
def create_output_column() -> Tuple[gr.Column, dict]:
|
||||
def create_output_column(disable_local_saving: bool = False) -> Tuple[gr.Column, dict]:
|
||||
"""Create the output column with audio player and file list."""
|
||||
with gr.Column(scale=1) as col:
|
||||
gr.Markdown("### Latest Output")
|
||||
audio_output = gr.Audio(label="Generated Speech", type="filepath")
|
||||
|
||||
gr.Markdown("### Generated Files")
|
||||
# Create file-related components with visible=False when local saving is disabled
|
||||
gr.Markdown("### Generated Files", visible=not disable_local_saving)
|
||||
output_files = gr.Dropdown(
|
||||
label="Previous Outputs",
|
||||
choices=files.list_output_files(),
|
||||
choices=files.list_output_files() if not disable_local_saving else [],
|
||||
value=None,
|
||||
allow_custom_value=False,
|
||||
visible=not disable_local_saving,
|
||||
)
|
||||
|
||||
play_btn = gr.Button("▶️ Play Selected", size="sm")
|
||||
play_btn = gr.Button(
|
||||
"▶️ Play Selected",
|
||||
size="sm",
|
||||
visible=not disable_local_saving,
|
||||
)
|
||||
|
||||
selected_audio = gr.Audio(
|
||||
label="Selected Output", type="filepath", visible=False
|
||||
label="Selected Output",
|
||||
type="filepath",
|
||||
visible=False, # Always initially hidden
|
||||
)
|
||||
|
||||
clear_outputs = gr.Button(
|
||||
"⚠️ Delete All Previously Generated Output Audio 🗑️",
|
||||
size="sm",
|
||||
variant="secondary",
|
||||
visible=not disable_local_saving,
|
||||
)
|
||||
|
||||
components = {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import gradio as gr
|
||||
import os
|
||||
|
||||
from . import api
|
||||
from .handlers import setup_event_handlers
|
||||
|
@ -10,6 +11,9 @@ def create_interface():
|
|||
# Skip initial status check - let the timer handle it
|
||||
is_available, available_voices = False, []
|
||||
|
||||
# Check if local saving is disabled
|
||||
disable_local_saving = os.getenv("DISABLE_LOCAL_SAVING", "false").lower() == "true"
|
||||
|
||||
with gr.Blocks(title="Kokoro TTS Demo", theme=gr.themes.Monochrome()) as demo:
|
||||
gr.HTML(
|
||||
value='<div style="display: flex; gap: 0;">'
|
||||
|
@ -26,7 +30,7 @@ def create_interface():
|
|||
model_col, model_components = create_model_column(
|
||||
available_voices
|
||||
) # Pass initial voices
|
||||
output_col, output_components = create_output_column()
|
||||
output_col, output_components = create_output_column(disable_local_saving)
|
||||
|
||||
# Collect all components
|
||||
components = {
|
||||
|
|
Loading…
Add table
Reference in a new issue