diff --git a/Dockerfile b/Dockerfile index 48e31fa894f4590754059137bc260680b83c92a8..379e1b3a71fddfcf96f7c06ca00e4fec5f31eff4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,34 @@ -FROM python:3.9 +# syntax=docker/dockerfile:1 +FROM python:3.8 -RUN pip install --user --upgrade pip -RUN apt-get update && apt-get install -y ffmpeg +RUN apt-get update && \ + apt-get install -y ffmpeg jq curl && \ + pip install --upgrade pip -COPY . . +WORKDIR /app +COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt -RUN mkdir -p /tmq -RUN chmod 777 /tmp -RUN mkdir -p /.cache -RUN chmod 777 /.cache +COPY scripts/ . +COPY app ./app +copy img ./img + +RUN wget --progress=bar:force:noscroll https://huggingface.co/fabiogra/baseline_vocal_remover/resolve/main/baseline.pth + +RUN mkdir -p /tmp/ /tmp/vocal_remover /.cache /.config && \ + chmod 777 /tmp /tmp/vocal_remover /.cache /.config ENV PYTHONPATH "${PYTHONPATH}:/app" +RUN chmod +x prepare_samples.sh + EXPOSE 7860 HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health -ENTRYPOINT ["streamlit", "run", "app/main.py", "--server.port=7860", "--server.address=0.0.0.0"] \ No newline at end of file +RUN ["./prepare_samples.sh"] + +ENTRYPOINT ["streamlit", "run", "app/header.py", "--server.port=7860", "--server.address=0.0.0.0"] diff --git a/README.md b/README.md index ad33575c99b1fe2ff8872687fba9e34e7684dfaf..1fb233328bf905c41a7e9c0d6047a5a9fe313baa 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,210 @@ --- -title: Music Splitter -emoji: 🎶 -colorFrom: indigo -colorTo: yellow +title: Test Moseca +emoji: 🎤🎸🥁🎹 +colorFrom: yellow +colorTo: purple sdk: docker +app_port: 7860 +models: ["https://huggingface.co/fabiogra/baseline_vocal_remover"] +tags: ["audio", "music", "vocal-removal", "karaoke", "music-separation", "music-source-separation"] pinned: true --- -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference +
+
+
Music Source Separation & Karaoke
-# Music Source Splitter 🎶 -Music Source Separation & Karaoke
", + unsafe_allow_html=True, + ) + + +if __name__ == "__main__": + header() diff --git a/app/helpers.py b/app/helpers.py index 2a02e10dbc2d825778f40611d8b4c4962243fc63..195d02157cf47e5adb9804afab5e344eb23df057 100644 --- a/app/helpers.py +++ b/app/helpers.py @@ -1,19 +1,160 @@ -from pydub import AudioSegment +import random +from io import BytesIO +import json -import streamlit as st -import plotly.graph_objs as go -import plotly.express as px -import pandas as pd +import matplotlib.pyplot as plt import numpy as np +import requests +import streamlit as st +from PIL import Image +from pydub import AudioSegment +from base64 import b64encode +from pathlib import Path +from streamlit.runtime.scriptrunner import RerunData, RerunException +from streamlit.source_util import get_pages +from streamlit_player import st_player + +extensions = ["mp3", "wav", "ogg", "flac"] # we will look for all those file types. +example_songs = [1, 2, 3] + + +def img_to_bytes(img_path): + img_bytes = Path(img_path).read_bytes() + encoded = b64encode(img_bytes).decode() + return encoded + + +# @st.cache_data(show_spinner=False) +def img_to_html(img_path): + img_html = "