Spaces:
Runtime error
Runtime error
Commit
·
fca1098
0
Parent(s):
Initial commit
Browse files- .gitattributes +33 -0
- .github/workflows/check-file-size.yml +16 -0
- .github/workflows/huggingface-sync.yml +20 -0
- .gitignore +131 -0
- README.md +12 -0
- app.py +74 -0
- requirements.txt +4 -0
- tag_map.json +72 -0
.gitattributes
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.github/workflows/check-file-size.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Check file size
|
| 2 |
+
on: # or directly `on: [push]` to run the action on every push on any branch
|
| 3 |
+
pull_request:
|
| 4 |
+
branches: [main]
|
| 5 |
+
|
| 6 |
+
# to run this workflow manually from the Actions tab
|
| 7 |
+
workflow_dispatch:
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
sync-to-hub:
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
steps:
|
| 13 |
+
- name: Check large files
|
| 14 |
+
uses: ActionsDesk/lfs-warning@v2.0
|
| 15 |
+
with:
|
| 16 |
+
filesizelimit: 10485760 # this is 10MB so we can sync to HF Spaces
|
.github/workflows/huggingface-sync.yml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Sync to Hugging Face hub
|
| 2 |
+
on:
|
| 3 |
+
push:
|
| 4 |
+
branches: [main]
|
| 5 |
+
|
| 6 |
+
# to run this workflow manually from the Actions tab
|
| 7 |
+
workflow_dispatch:
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
sync-to-hub:
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
steps:
|
| 13 |
+
- uses: actions/checkout@v2
|
| 14 |
+
with:
|
| 15 |
+
fetch-depth: 0
|
| 16 |
+
- name: Push to hub
|
| 17 |
+
env:
|
| 18 |
+
SYNC: ${{ secrets.SYNC }}
|
| 19 |
+
run: git push -f https://SLAYEROFALL3050:$SYNC@huggingface.co/spaces/SLAYEROFALL3050/Audio_Generator_Using_GAN main
|
| 20 |
+
|
.gitignore
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
|
| 6 |
+
# C extensions
|
| 7 |
+
*.so
|
| 8 |
+
|
| 9 |
+
# Distribution / packaging
|
| 10 |
+
.Python
|
| 11 |
+
build/
|
| 12 |
+
develop-eggs/
|
| 13 |
+
dist/
|
| 14 |
+
downloads/
|
| 15 |
+
eggs/
|
| 16 |
+
.eggs/
|
| 17 |
+
lib/
|
| 18 |
+
lib64/
|
| 19 |
+
parts/
|
| 20 |
+
sdist/
|
| 21 |
+
var/
|
| 22 |
+
wheels/
|
| 23 |
+
pip-wheel-metadata/
|
| 24 |
+
share/python-wheels/
|
| 25 |
+
*.egg-info/
|
| 26 |
+
.installed.cfg
|
| 27 |
+
*.egg
|
| 28 |
+
MANIFEST
|
| 29 |
+
|
| 30 |
+
# PyInstaller
|
| 31 |
+
# Usually these files are written by a python script from a template
|
| 32 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 33 |
+
*.manifest
|
| 34 |
+
*.spec
|
| 35 |
+
|
| 36 |
+
# Installer logs
|
| 37 |
+
pip-log.txt
|
| 38 |
+
pip-delete-this-directory.txt
|
| 39 |
+
|
| 40 |
+
# Unit test / coverage reports
|
| 41 |
+
htmlcov/
|
| 42 |
+
.tox/
|
| 43 |
+
.nox/
|
| 44 |
+
.coverage
|
| 45 |
+
.coverage.*
|
| 46 |
+
.cache
|
| 47 |
+
nosetests.xml
|
| 48 |
+
coverage.xml
|
| 49 |
+
*.cover
|
| 50 |
+
*.py,cover
|
| 51 |
+
.hypothesis/
|
| 52 |
+
.pytest_cache/
|
| 53 |
+
|
| 54 |
+
# Translations
|
| 55 |
+
*.mo
|
| 56 |
+
*.pot
|
| 57 |
+
|
| 58 |
+
# Django stuff:
|
| 59 |
+
*.log
|
| 60 |
+
local_settings.py
|
| 61 |
+
db.sqlite3
|
| 62 |
+
db.sqlite3-journal
|
| 63 |
+
|
| 64 |
+
# Flask stuff:
|
| 65 |
+
instance/
|
| 66 |
+
.webassets-cache
|
| 67 |
+
|
| 68 |
+
# Scrapy stuff:
|
| 69 |
+
.scrapy
|
| 70 |
+
|
| 71 |
+
# Sphinx documentation
|
| 72 |
+
docs/_build/
|
| 73 |
+
|
| 74 |
+
# PyBuilder
|
| 75 |
+
target/
|
| 76 |
+
|
| 77 |
+
# Jupyter Notebook
|
| 78 |
+
.ipynb_checkpoints
|
| 79 |
+
|
| 80 |
+
# IPython
|
| 81 |
+
profile_default/
|
| 82 |
+
ipython_config.py
|
| 83 |
+
|
| 84 |
+
# pyenv
|
| 85 |
+
.python-version
|
| 86 |
+
|
| 87 |
+
# pipenv
|
| 88 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 89 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 90 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 91 |
+
# install all needed dependencies.
|
| 92 |
+
#Pipfile.lock
|
| 93 |
+
|
| 94 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
| 95 |
+
__pypackages__/
|
| 96 |
+
|
| 97 |
+
# Celery stuff
|
| 98 |
+
celerybeat-schedule
|
| 99 |
+
celerybeat.pid
|
| 100 |
+
|
| 101 |
+
# SageMath parsed files
|
| 102 |
+
*.sage.py
|
| 103 |
+
|
| 104 |
+
# Environments
|
| 105 |
+
.env
|
| 106 |
+
.venv
|
| 107 |
+
env/
|
| 108 |
+
venv/
|
| 109 |
+
ENV/
|
| 110 |
+
env.bak/
|
| 111 |
+
venv.bak/
|
| 112 |
+
|
| 113 |
+
# Spyder project settings
|
| 114 |
+
.spyderproject
|
| 115 |
+
.spyproject
|
| 116 |
+
|
| 117 |
+
# Rope project settings
|
| 118 |
+
.ropeproject
|
| 119 |
+
|
| 120 |
+
# mkdocs documentation
|
| 121 |
+
/site
|
| 122 |
+
|
| 123 |
+
# mypy
|
| 124 |
+
.mypy_cache/
|
| 125 |
+
.dmypy.json
|
| 126 |
+
dmypy.json
|
| 127 |
+
|
| 128 |
+
# Pyre type checker
|
| 129 |
+
.pyre/
|
| 130 |
+
|
| 131 |
+
# Own Stuff Goes After This
|
README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Fire Coml FALL 2022
|
| 3 |
+
emoji: 🎶
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: orange
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.10.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from streamlit_tags import st_tags
|
| 3 |
+
import json
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
f = open('tag_map.json') # OPEN JSON FILE
|
| 7 |
+
|
| 8 |
+
data = json.load(f) # LOAD DATA
|
| 9 |
+
|
| 10 |
+
f.close() # CLOSE FILE
|
| 11 |
+
|
| 12 |
+
# --------------------------- VARIABLES
|
| 13 |
+
|
| 14 |
+
# SPLIT DATA
|
| 15 |
+
GENRE_TAGS = data['genre']
|
| 16 |
+
MOOD_TAGS = data['mood']
|
| 17 |
+
INSTRUMENT_TAGS = data['instrument']
|
| 18 |
+
|
| 19 |
+
MAX_TAGS = 3
|
| 20 |
+
|
| 21 |
+
# --------------------------- TITLE
|
| 22 |
+
st.title("FIRE COML FALL 2022 Audio Generation Model")
|
| 23 |
+
|
| 24 |
+
# --------------------------- MAIN
|
| 25 |
+
# SELECT TYPE OF GENERATION
|
| 26 |
+
option = st.selectbox("Select Generation type:", ("Sentence Based", "Tag Based"))
|
| 27 |
+
|
| 28 |
+
# SENTENCE BASED
|
| 29 |
+
if option == "Sentence Based":
|
| 30 |
+
input_sentence = st.text_input("Enter a description for a song you want to hear:")
|
| 31 |
+
|
| 32 |
+
# SUBMIT DESCRIPTION
|
| 33 |
+
if st.button("Submit Description"):
|
| 34 |
+
if input_sentence is not None and len(input_sentence) > 0:
|
| 35 |
+
st.write("Here is the generated audio: ")
|
| 36 |
+
st.write(input_sentence)
|
| 37 |
+
else:
|
| 38 |
+
st.write("Invalid Description")
|
| 39 |
+
|
| 40 |
+
# TAG BASED
|
| 41 |
+
else:
|
| 42 |
+
st.write("Enter Genre(s), Mood/Theme(s), and Instrument(s)")
|
| 43 |
+
|
| 44 |
+
instructions = "Press enter to add more"
|
| 45 |
+
|
| 46 |
+
genre = st_tags(
|
| 47 |
+
label = 'Enter Genre(s):',
|
| 48 |
+
text = instructions,
|
| 49 |
+
suggestions = GENRE_TAGS,
|
| 50 |
+
maxtags = MAX_TAGS,
|
| 51 |
+
key = '1'
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
mood = st_tags(
|
| 55 |
+
label = 'Enter Mood/Theme(s):',
|
| 56 |
+
text = instructions,
|
| 57 |
+
suggestions = MOOD_TAGS,
|
| 58 |
+
maxtags = MAX_TAGS,
|
| 59 |
+
key = '2'
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
instrument = st_tags(
|
| 63 |
+
label = 'Enter Instrument(s):',
|
| 64 |
+
text = instructions,
|
| 65 |
+
suggestions = INSTRUMENT_TAGS,
|
| 66 |
+
maxtags = MAX_TAGS,
|
| 67 |
+
key = '3'
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
# SUBMIT TAGS
|
| 71 |
+
if st.button("Submit Tags"):
|
| 72 |
+
st.write("Tags are:")
|
| 73 |
+
input = genre + mood + instrument
|
| 74 |
+
st.write(str(input))
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tensorflow==2.9.1
|
| 2 |
+
gdown==4.4.0
|
| 3 |
+
streamlit==1.10.0
|
| 4 |
+
streamlit-tags==1.2.7
|
tag_map.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"genre": [
|
| 3 |
+
"punkrock",
|
| 4 |
+
"electronica",
|
| 5 |
+
"soundtrack",
|
| 6 |
+
"electronic",
|
| 7 |
+
"electronic",
|
| 8 |
+
"poprock",
|
| 9 |
+
"rockandroll",
|
| 10 |
+
"ambient",
|
| 11 |
+
"electropop",
|
| 12 |
+
"house",
|
| 13 |
+
"r&b",
|
| 14 |
+
"dance",
|
| 15 |
+
"folkpop",
|
| 16 |
+
"lounge",
|
| 17 |
+
"trance",
|
| 18 |
+
"progressive",
|
| 19 |
+
"classical",
|
| 20 |
+
"electronica",
|
| 21 |
+
"rap",
|
| 22 |
+
"techno",
|
| 23 |
+
"alternative",
|
| 24 |
+
"instrumentalhiphop"
|
| 25 |
+
],
|
| 26 |
+
"mood": [
|
| 27 |
+
"dreamy",
|
| 28 |
+
"emotional",
|
| 29 |
+
"film",
|
| 30 |
+
"energetic",
|
| 31 |
+
"inspirational",
|
| 32 |
+
"love",
|
| 33 |
+
"melancholic",
|
| 34 |
+
"relaxed",
|
| 35 |
+
"sad",
|
| 36 |
+
"romantic",
|
| 37 |
+
"hopeful",
|
| 38 |
+
"motivational",
|
| 39 |
+
"happy",
|
| 40 |
+
"sports",
|
| 41 |
+
"children",
|
| 42 |
+
"trailer",
|
| 43 |
+
"joyful",
|
| 44 |
+
"christmas",
|
| 45 |
+
"epic",
|
| 46 |
+
"dark",
|
| 47 |
+
"scifi",
|
| 48 |
+
"festive"
|
| 49 |
+
],
|
| 50 |
+
"instrument": [
|
| 51 |
+
"synthesizer",
|
| 52 |
+
"drums",
|
| 53 |
+
"strings",
|
| 54 |
+
"guitar",
|
| 55 |
+
"piano",
|
| 56 |
+
"saxophone",
|
| 57 |
+
"beat",
|
| 58 |
+
"violin",
|
| 59 |
+
"bell",
|
| 60 |
+
"percussion",
|
| 61 |
+
"choir",
|
| 62 |
+
"pad",
|
| 63 |
+
"flute",
|
| 64 |
+
"electricguitar",
|
| 65 |
+
"keyboard",
|
| 66 |
+
"horn",
|
| 67 |
+
"bongo",
|
| 68 |
+
"accordion",
|
| 69 |
+
"bass",
|
| 70 |
+
"clavier"
|
| 71 |
+
]
|
| 72 |
+
}
|