-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
116 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: '3' | ||
services: | ||
db: | ||
build: | ||
context: ./docker/postgres | ||
environment: | ||
- POSTGRES_DB=dejavu | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=password | ||
networks: | ||
- db_network | ||
python: | ||
build: | ||
context: ./docker/python | ||
volumes: | ||
- .:/code | ||
depends_on: | ||
- db | ||
networks: | ||
- db_network | ||
networks: | ||
db_network: |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FROM postgres:10.7-alpine | ||
COPY init.sql /docker-entrypoint-initdb.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- put any SQL you'd like to run on creation of the image | ||
-- in this file :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM python:3.7 | ||
RUN apt-get update -y && apt-get upgrade -y | ||
RUN apt-get install \ | ||
gcc nano \ | ||
ffmpeg libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 \ | ||
postgresql postgresql-contrib -y | ||
RUN pip install numpy scipy matplotlib pydub pyaudio psycopg2 | ||
WORKDIR /code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import json | ||
|
||
from dejavu import Dejavu | ||
from dejavu.logic.recognizer.file_recognizer import FileRecognizer | ||
from dejavu.logic.recognizer.microphone_recognizer import MicrophoneRecognizer | ||
|
||
# load config from a JSON file (or anything outputting a python dictionary) | ||
config = { | ||
"database": { | ||
"host": "db", | ||
"user": "postgres", | ||
"password": "password", | ||
"database": "dejavu" | ||
}, | ||
"database_type": "postgres" | ||
} | ||
|
||
if __name__ == '__main__': | ||
|
||
# create a Dejavu instance | ||
djv = Dejavu(config) | ||
|
||
# Fingerprint all the mp3's in the directory we give it | ||
djv.fingerprint_directory("test", [".wav"]) | ||
|
||
# Recognize audio from a file | ||
results = djv.recognize(FileRecognizer, "mp3/Josh-Woodward--I-Want-To-Destroy-Something-Beautiful.mp3") | ||
print(f"From file we recognized: {results}\n") | ||
|
||
# Or use a recognizer without the shortcut, in anyway you would like | ||
recognizer = FileRecognizer(djv) | ||
results = recognizer.recognize_file("mp3/Josh-Woodward--I-Want-To-Destroy-Something-Beautiful.mp3") | ||
print(f"No shortcut, we recognized: {results}\n") |