Skip to content

Commit

Permalink
Merge branch 'main' into exp/gradio-v5
Browse files Browse the repository at this point in the history
  • Loading branch information
Vidalnt committed Dec 3, 2024
2 parents cf298ff + 9ec21c2 commit ba2f7a6
Show file tree
Hide file tree
Showing 124 changed files with 17,971 additions and 5,278 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/pre_compiled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
python-version: ["3.10.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Free up space on runner
run: |
sudo rm -rf /usr/share/dotnet
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
python-version: ["3.10.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Free up space on runner
run: |
sudo rm -rf /usr/share/dotnet
Expand Down Expand Up @@ -200,7 +200,7 @@ jobs:
python-version: ["3.10.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -233,7 +233,7 @@ jobs:
print(f'Finished recording filesystem timestamps to {output_file}.')
scan_and_write(\"/opt/hostedtoolcache/Python/3.10.12/x64\", \"./usr_files.csv\")"
- name: Install dependencies
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install torch==2.3.1 torchvision torchaudio --upgrade --index-url https://download.pytorch.org/whl/cu121
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v5
with:
python-version: "3.8"

Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
if [[ "$commit_data" == "[]" ]]; then
echo "No commits found for tag $previous_tag. Using current date."
commit_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
commit_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
else
commit_date=$(echo "$commit_data" | jq -r '.[0].commit.committer.date')
fi
Expand Down Expand Up @@ -129,10 +129,10 @@ jobs:
run: |
npm install https://github.com/IAHispano/gh-release.git
- name: Create package.json
- name: Create package.json
if: steps.check-version.outputs.tag
run: |
cd /home/runner/work/Applio/Applio
cd /home/runner/work/Applio/Applio
echo '{}' > package.json
jq \
--arg version "${{ steps.check-version.outputs.tag }}" \
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
logs
env
venv
.venv
.venv
rvc/models
25 changes: 20 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
# syntax=docker/dockerfile:1

FROM python:3.10-bullseye

# Expose the required port
EXPOSE 6969

# Set up working directory
WORKDIR /app

RUN apt update && apt install -y -qq ffmpeg aria2 && apt clean
# Install system dependencies, clean up cache to keep image size small
RUN apt update && \
apt install -y -qq ffmpeg && \
apt clean && rm -rf /var/lib/apt/lists/*

# Copy application files into the container
COPY . .

RUN pip3 install --no-cache-dir -r requirements.txt
# Create a virtual environment in the app directory and install dependencies
RUN python3 -m venv /app/.venv && \
. /app/.venv/bin/activate && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir python-ffmpeg && \
pip install --no-cache-dir torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu121 && \
if [ -f "requirements.txt" ]; then pip install --no-cache-dir -r requirements.txt; fi

VOLUME [ "/app/logs/weights", "/app/opt" ]
# Define volumes for persistent storage
VOLUME ["/app/logs/"]

ENTRYPOINT [ "python3" ]
# Set environment variables if necessary
ENV PATH="/app/.venv/bin:$PATH"

# Run the app
ENTRYPOINT ["python3"]
CMD ["app.py"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<a href="https://docs.applio.org" target="_blank">📚 Documentation</a>
<a href="https://discord.gg/iahispano" target="_blank">☎️ Discord</a>
<a href="https://discord.gg/urxFjYmYYh" target="_blank">☎️ Discord</a>
</p>

<p align="center">
Expand Down
28 changes: 8 additions & 20 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,7 @@
from tabs.tts.tts import tts_tab
from tabs.voice_blender.voice_blender import voice_blender_tab
from tabs.plugins.plugins import plugins_tab
from tabs.settings.version import version_tab
from tabs.settings.lang import lang_tab
from tabs.settings.restart import restart_tab
from tabs.settings.presence import presence_tab, load_config_presence
from tabs.settings.flask_server import flask_server_tab
from tabs.settings.themes import theme_tab
from tabs.settings.precision import precision_tab
from tabs.settings.model_author import model_author_tab
from tabs.settings.settings import settings_tab

# Run prerequisites
from core import run_prerequisites_script
Expand All @@ -54,6 +47,8 @@
i18n = I18nAuto()

# Start Discord presence if enabled
from tabs.settings.sections.presence import load_config_presence

if load_config_presence():
from assets.discord_presence import RPCManager

Expand All @@ -74,7 +69,7 @@
# Load theme
import assets.themes.loadThemes as loadThemes

my_applio = loadThemes.load_json() or "ParityError/Interstellar"
my_applio = loadThemes.load_theme() or "ParityError/Interstellar"

# Define Gradio interface
with gr.Blocks(
Expand All @@ -83,18 +78,18 @@
gr.Markdown("# Applio")
gr.Markdown(
i18n(
"VITS-based Voice Conversion focused on simplicity, quality and performance."
"A simple, high-quality voice conversion tool focused on ease of use and performance."
)
)
gr.Markdown(
i18n(
"[Support](https://discord.gg/IAHispano) — [Discord Bot](https://discord.com/oauth2/authorize?client_id=1144714449563955302&permissions=1376674695271&scope=bot%20applications.commands) — [Find Voices](https://applio.org/models) — [GitHub](https://github.com/IAHispano/Applio)"
"[Support](https://discord.gg/urxFjYmYYh) — [Discord Bot](https://discord.com/oauth2/authorize?client_id=1144714449563955302&permissions=1376674695271&scope=bot%20applications.commands) — [Find Voices](https://applio.org/models) — [GitHub](https://github.com/IAHispano/Applio)"
)
)
with gr.Tab(i18n("Inference")):
inference_tab()

with gr.Tab(i18n("Train")):
with gr.Tab(i18n("Training")):
train_tab()

with gr.Tab(i18n("TTS")):
Expand All @@ -116,14 +111,7 @@
extra_tab()

with gr.Tab(i18n("Settings")):
presence_tab()
flask_server_tab()
precision_tab()
theme_tab()
version_tab()
lang_tab()
restart_tab()
model_author_tab()
settings_tab()


def launch_gradio(port):
Expand Down
59 changes: 32 additions & 27 deletions assets/Applio.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"## **Applio**\n",
"A simple, high-quality voice conversion tool focused on ease of use and performance.\n",
"\n",
"[Support](https://discord.gg/IAHispano) — [Discord Bot](https://discord.com/oauth2/authorize?client_id=1144714449563955302&permissions=1376674695271&scope=bot%20applications.commands) — [Find Voices](https://applio.org/models) — [GitHub](https://github.com/IAHispano/Applio)\n",
"[Support](https://discord.gg/urxFjYmYYh) — [Discord Bot](https://discord.com/oauth2/authorize?client_id=1144714449563955302&permissions=1376674695271&scope=bot%20applications.commands) — [Find Voices](https://applio.org/models) — [GitHub](https://github.com/IAHispano/Applio)\n",
"\n",
"<br>\n",
"\n",
Expand Down Expand Up @@ -57,12 +57,12 @@
"uioawhd = rot_47(codecs.decode(\"pbbxa://oqbpcj.kwu/QIPqaxivw/Ixxtqw.oqb\", \"rot_13\"))\n",
"uyadwa = codecs.decode(\"ncc.cl\", \"rot_13\")\n",
"A = \"/content/\" + rot_47(\"Kikpm.ovm.bu\")\n",
"!git clone --depth 1 $uioawhd $new_name --branch 3.2.6 --single-branch\n",
"!git clone --depth 1 $uioawhd $new_name --branch 3.2.7 --single-branch\n",
"%cd $new_name/\n",
"clear_output()\n",
"def vidal_setup():\n",
" A = \"/content/\" + rot_47(\"Kikpm.ovm.bu\")\n",
" \n",
"\n",
" D = \"/\"\n",
" if not os.path.exists(A):\n",
" M = os.path.dirname(A)\n",
Expand All @@ -87,7 +87,9 @@
" os.remove(A)\n",
"\n",
"vidal_setup()\n",
"!pip uninstall torch torchvision torchaudio -y\n",
"!pip install pydantic==2.8.2 fastapi==0.112.0 starlette==0.37.2\n",
"!pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --upgrade --index-url https://download.pytorch.org/whl/cu121\n",
"clear_output()\n",
"print(\"Finished installing requirements! \")"
]
Expand Down Expand Up @@ -205,13 +207,17 @@
"source": [
"# @title Auto Backup\n",
"# @markdown When running it, it will be activated or deactivated previously to start up together with Applio.\n",
"import os\n",
"import shutil\n",
"import time\n",
"\n",
"LOGS_FOLDER = \"/content/program_ml/logs/\"\n",
"GOOGLE_DRIVE_PATH = \"/content/drive/MyDrive/ApplioBackup\"\n",
"\n",
"if \"autobackups\" not in globals():\n",
" autobackups = False\n",
"\n",
"\n",
"cooldown = 15 # @param {type:\"slider\", min:0, max:100, step:0}\n",
"def backup_files():\n",
" print(\"\\nStarting backup loop...\")\n",
" last_backup_timestamps_path = os.path.join(\n",
Expand All @@ -221,7 +227,9 @@
"\n",
" while True:\n",
" try:\n",
" updated = False\n",
" updated_files = 0\n",
" deleted_files = 0\n",
" new_files = 0\n",
" last_backup_timestamps = {}\n",
"\n",
" try:\n",
Expand All @@ -231,11 +239,12 @@
" pass\n",
"\n",
" for root, dirs, files in os.walk(LOGS_FOLDER):\n",
" # Excluding \"zips\" directory\n",
" # Excluding \"zips\" and \"mute\" directories\n",
" if \"zips\" in dirs:\n",
" dirs.remove(\"zips\")\n",
" if \"mute\" in dirs:\n",
" dirs.remove(\"mute\")\n",
"\n",
" for filename in files:\n",
" if filename != \"last_backup_timestamps.txt\":\n",
" filepath = os.path.join(root, filename)\n",
Expand All @@ -247,26 +256,19 @@
" backup_folderpath = os.path.dirname(backup_filepath)\n",
" if not os.path.exists(backup_folderpath):\n",
" os.makedirs(backup_folderpath)\n",
" print(\n",
" f\"Created backup folder: {backup_folderpath}\",\n",
" flush=True,\n",
" )\n",
" last_backup_timestamp = last_backup_timestamps.get(filepath)\n",
" current_timestamp = os.path.getmtime(filepath)\n",
" if (\n",
" last_backup_timestamp is None\n",
" or float(last_backup_timestamp) < current_timestamp\n",
" ):\n",
" shutil.copy2(filepath, backup_filepath)\n",
" last_backup_timestamps[filepath] = str(\n",
" current_timestamp\n",
" )\n",
" last_backup_timestamps[filepath] = str(current_timestamp)\n",
" if last_backup_timestamp is None:\n",
" print(f\"Backed up file: {filename}\")\n",
" new_files += 1\n",
" else:\n",
" print(f\"Updating backed up file: {filename}\")\n",
" updated = True\n",
" fully_updated = False\n",
" updated_files += 1\n",
"\n",
"\n",
" for filepath in list(last_backup_timestamps.keys()):\n",
" if not os.path.exists(filepath):\n",
Expand All @@ -275,26 +277,26 @@
" )\n",
" if os.path.exists(backup_filepath):\n",
" os.remove(backup_filepath)\n",
" print(f\"Deleted file: {filepath}\")\n",
" deleted_files += 1\n",
" del last_backup_timestamps[filepath]\n",
" updated = True\n",
" fully_updated = False\n",
"\n",
" if not updated and not fully_updated:\n",
"\n",
" if updated_files > 0 or deleted_files > 0 or new_files > 0:\n",
" print(f\"Backup Complete: {new_files} new, {updated_files} updated, {deleted_files} deleted.\")\n",
" fully_updated = False\n",
" elif not fully_updated:\n",
" print(\"Files are up to date.\")\n",
" fully_updated = True\n",
" sleep_time = 15\n",
" else:\n",
" sleep_time = 0.1\n",
"\n",
" with open(last_backup_timestamps_path, \"w\") as f:\n",
" for filepath, timestamp in last_backup_timestamps.items():\n",
" f.write(f\"{filepath}:{timestamp}\\n\")\n",
"\n",
" time.sleep(sleep_time)\n",
" time.sleep(cooldown if fully_updated else 0.1)\n",
"\n",
"\n",
" except Exception as error:\n",
" print(f\"An error occurred during backup: {error}\", flush=True)\n",
" print(f\"An error occurred during backup: {error}\")\n",
"\n",
"\n",
"if autobackups:\n",
Expand All @@ -308,7 +310,10 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"cellView": "form",
"id": "-vIzj7pye8Z0"
},
"outputs": [],
"source": [
"# @title Setup new logs folder format\n",
Expand Down
Loading

0 comments on commit ba2f7a6

Please sign in to comment.