Skip to content

Commit

Permalink
update : start v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
minjunj committed May 21, 2024
0 parents commit ebc5b59
Show file tree
Hide file tree
Showing 17 changed files with 468 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
64 changes: 64 additions & 0 deletions .github/workflows/build_and_deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Push Docker Image

on:
push:
branches:
- main
permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
outputs:
IMAGE_TAG: ${{ github.run_number }}

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
env:
IMAGE_TAG: ${{ github.run_number }}
with:
context: .
push: true
tags: minjuncho/blms-fe:${{ env.IMAGE_TAG }}
id: docker_build

- name: Output the image tag
run: echo "IMAGE_TAG=${{ steps.docker_build.outputs.digest }}" >> $GITHUB_ENV

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out infra-ops repository
uses: actions/checkout@v2
with:
repository: "keiburu-Tai/infra-ops"
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
fetch-depth: 0

- name: List directory contents
run: ls -R

- name: Update Kubernetes Manifests
env:
IMAGE_TAG: ${{ github.run_number }}
run: |
sed -i 's|image:.*|image: minjuncho/blms-fe:${{ env.IMAGE_TAG }}|' service/blms-fe/blms-fe.yaml
- name: commit and push
run: |
git config user.name github-actions
git config user.email [email protected]
git commit -am "Deploying image ${{ env.IMAGE_TAG }}"
git push origin main
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.env

*.mid
*.wav
2 changes: 2 additions & 0 deletions .streamlit/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[server]
baseUrlPath = "blms"
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.9-slim

WORKDIR /app

COPY . .

RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
libasound2-dev \
libsndfile1 \
portaudio19-dev \
&& rm -rf /var/lib/apt/lists/*

RUN pip install --upgrade pip
RUN pip install st-pages sounddevice soundfile streamlit streamlit_webrtc bokeh streamlit-bokeh-events

EXPOSE 8501

ENTRYPOINT ["streamlit", "run", "streamlit.py", "--server.port=8501", "--server.address=0.0.0.0"]
Binary file added __pycache__/main.cpython-311.pyc
Binary file not shown.
77 changes: 77 additions & 0 deletions play.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import streamlit as st
import pandas as pd
import numpy as np
from st_pages import Page, Section, show_pages, add_page_title
import time

import sounddevice as sd
import soundfile as sf


st.title('''Playing Guitar!''')

def list_devices():
#print("Available audio devices:")
name_dict = {}
devices = sd.query_devices()
i = 0
for index, device in enumerate(devices):
#print(index, device['name'], ", Core Audio (", device['max_input_channels'], "in,", device['max_output_channels'], "out)")
name_dict[device['name']] = i
i += 1
#print(name_dict)
return name_dict

def record_audio(device_index, duration=10, sample_rate=44100):
try:
device_info = sd.query_devices(device_index)
audio_data = sd.rec(int(duration * sample_rate), samplerate=sample_rate, channels=2, device=device_index, dtype='float32')
sd.wait() # Wait until recording is finished
# Save recorded data as a WAV file
output_file = 'recoded_sample/first.wav'
sf.write(output_file, audio_data, sample_rate)
except Exception as e:
print(f"An error occurred: {e}")
st.error(f'An error occurred: {e}')


with st.container(border=True):
try:
ele = list_devices()
input_option = st.selectbox(
"Please Select Input Device.",
(ele.keys()))

output_option = st.selectbox(
"Please Select Output Device",
(ele.keys()))

time_duration = st.slider("How long recode?", 0, 20, 10)
col1, col2 = st.columns([0.2, 1.4])
with col1:
if st.button("Recode"):
st.session_state["Recode"] = True
with col2:
if st.button("Save"):
st.session_state["Save"] = True
if 'Recode' in st.session_state and st.session_state['Recode']:
st.write('1')
time.sleep(1)
st.write('2')
time.sleep(1)
st.write('3')
time.sleep(0.5)
st.write("ready")
time.sleep(0.5)
st.write('start!!!')
with st.spinner('recording...'):

record_audio(ele.get(input_option), duration=time_duration, sample_rate=44100)
st.audio("recoded_sample/first.wav", format="audio/mpeg", loop=False)
st.session_state['Recode'] = False
if 'Save' in st.session_state and st.session_state['Save']:
st.write("Shot Auto Chord")
st.success('This is a success message!')
st.session_state['Save'] = False
except:
pass
Binary file added recoded_sample/.DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions recoded_sample/recoded_sample/canon_chords.lab
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
0.0 1.4396371882086167 C:maj
1.4396371882086167 3.01859410430839 G:maj
3.01859410430839 4.551111111111111 A:min
4.551111111111111 5.944308390022676 E:maj
5.944308390022676 6.03718820861678 N
6.03718820861678 7.476825396825397 F:maj
7.476825396825397 8.962902494331066 G:maj
8.962902494331066 10.031020408163265 C:maj
8 changes: 8 additions & 0 deletions recoded_sample/recoded_sample/dont_lazy.lab
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
0.0 1.486077097505669 C:maj
1.486077097505669 2.9257142857142857 D:maj
2.9257142857142857 4.2260317460317465 B:min
4.2260317460317465 5.944308390022676 E:min
5.944308390022676 5.990748299319728 N
5.990748299319728 7.058866213151927 C:maj
7.058866213151927 8.40562358276644 D:maj
8.40562358276644 10.031020408163265 E:min
9 changes: 9 additions & 0 deletions recoded_sample/recoded_sample/honey_jet.lab
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
0.0 1.4396371882086167 E:maj
1.4396371882086167 3.4829931972789114 Gb:maj
3.4829931972789114 4.96907029478458 Eb:min
4.96907029478458 5.944308390022676 Ab:min
5.944308390022676 6.269387755102041 N
6.269387755102041 7.801904761904762 Db:min
7.801904761904762 8.684263038548753 Eb:min
8.684263038548753 9.195102040816327 Gb:maj
9.195102040816327 10.031020408163265 E:maj
9 changes: 9 additions & 0 deletions recoded_sample/recoded_sample/honey_jet_pre_skip.lab
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
0.0 0.18575963718820862 E:maj
0.18575963718820862 2.2291156462585033 Gb:maj
2.2291156462585033 3.1579138321995464 Eb:min
3.1579138321995464 4.08671201814059 N
4.08671201814059 4.96907029478458 Ab:min
4.96907029478458 5.944308390022676 Db:min
5.944308390022676 6.455147392290249 N
6.455147392290249 7.987664399092971 Eb:min
7.987664399092971 10.031020408163265 E:maj
11 changes: 11 additions & 0 deletions recoded_sample/recoded_sample/line.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
허니제트
E F# D#m G#m C#m D#m E

dont lazy
C5 D5 B5 E5 D5 C5 D5 E5

canon
C G Em Am F G C

solo
penta 3 C major
1 change: 1 addition & 0 deletions recoded_sample/recoded_sample/solo.lab
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0 10.031020408163265 N
106 changes: 106 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
aioice==0.9.0
aiortc==1.8.0
altair==5.3.0
annotated-types==0.6.0
anyio==4.3.0
attrs==23.2.0
audioread==3.0.1
av==11.0.0
beautifulsoup4==4.12.3
blinker==1.8.1
cachetools==5.3.3
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
cryptography==42.0.7
decorator==5.1.1
dnspython==2.6.1
email_validator==2.1.1
exceptiongroup==1.2.1
fastapi==0.111.0
fastapi-cli==0.0.3
filelock==3.14.0
gdown==5.2.0
gitdb==4.0.11
GitPython==3.1.43
google-crc32c==1.5.0
h11==0.14.0
httpcore==1.0.5
httptools==0.6.1
httpx==0.27.0
idna==3.7
ifaddr==0.2.0
Jinja2==3.1.4
joblib==1.4.2
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
lazy_loader==0.4
lazycats==0.1.0
librosa==0.10.2
llvmlite==0.42.0
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
mido==1.3.2
msgpack==1.0.8
numba==0.59.1
numpy==1.26.4
orjson==3.10.3
packaging==23.2
pandas==2.2.2
pillow==10.3.0
platformdirs==4.2.1
pooch==1.8.1
protobuf==4.25.3
pyarrow==16.0.0
pycparser==2.22
pydantic==2.7.1
pydantic_core==2.18.2
pydeck==0.9.0
pyee==11.1.0
pygame==2.5.2
Pygments==2.18.0
pylibsrtp==0.10.0
pyOpenSSL==24.1.0
PySocks==1.7.1
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-multipart==0.0.9
python-rtmidi==1.5.8
pytz==2024.1
PyYAML==6.0.1
referencing==0.35.1
requests==2.31.0
rich==13.7.1
rpds-py==0.18.1
scikit-learn==1.4.2
scipy==1.13.0
shellingham==1.5.4
six==1.16.0
smmap==5.0.1
sniffio==1.3.1
sounddevice==0.4.6
soundfile==0.12.1
soupsieve==2.5
soxr==0.3.7
st-pages==0.4.5
starlette==0.37.2
streamlit==1.34.0
streamlit-webrtc==0.47.6
tenacity==8.2.3
threadpoolctl==3.5.0
toml==0.10.2
toolz==0.12.1
tornado==6.4
tqdm==4.66.4
typer==0.12.3
typing_extensions==4.11.0
tzdata==2024.1
ujson==5.10.0
urllib3==2.2.1
uvicorn==0.29.0
uvloop==0.19.0
vamp==1.1.0
watchfiles==0.21.0
websockets==12.0
Loading

0 comments on commit ebc5b59

Please sign in to comment.