Compare commits

..

No commits in common. "master" and "1.1" have entirely different histories.
master ... 1.1

40 changed files with 16 additions and 120 deletions

View File

@ -1,25 +1,19 @@
# THIS IS ONLY A TEST, NOT READY FOR PRODUCTION
FROM ubuntu:21.04 FROM ubuntu:21.04
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV ENV_STATUS=${NODE_ENV:-production}
# For suport set local time zone. WORKDIR /jarvis-server
RUN apt-get update -y && apt-get upgrade -y
WORKDIR /jarvis RUN apt update && apt upgrade -y
RUN apt install python3.9 python3-pip python3.9-dev python3.9-distutils python3-fann2 libfann-dev swig git python3-levenshtein curl -y RUN apt install python3.9 python3-pip python3.9-dev python3.9-distutils python3-fann2 libfann-dev swig git python3-levenshtein -y
RUN git clone --branch $(curl --silent "https://api.github.com/repos/m4th1eu/jarvis-server/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")') --progress --verbose https://github.com/M4TH1EU/jarvis-server.git . RUN git clone --progress --verbose https://github.com/M4TH1EU/jarvis-server.git .
RUN python3 -m pip install -r requirements.txt RUN python3 -m pip install -r requirements.txt
RUN apt-get clean -y
EXPOSE 5000 EXPOSE 5000
COPY start.sh /jarvis/ ENTRYPOINT ["python3", "run.py"]
RUN chmod +x start.sh
CMD "./start.sh"

View File

@ -1,29 +0,0 @@
# ALPINE VERSION OF THE DOCKER FILE, NOT WORKING ATM.
# TRYING TO SEE IF THERE IS A DIFFERENCE USING AN UBUNTU IMAGE OR AN ALPINE
FROM alpine:latest
ENV ENV_STATUS=${NODE_ENV:-production}
# For suport set local time zone.
RUN apk update && apk upgrade
RUN apk add --no-cache --upgrade grep
WORKDIR /jarvis
RUN apk add build-base python3 python3-dev py3-pip py3-distutils-extra py3-fann2 fann-dev swig git curl
RUN git clone --branch $(curl --silent "https://api.github.com/repos/m4th1eu/jarvis-server/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")') --progress --verbose https://github.com/M4TH1EU/jarvis-server.git .
RUN python3 -m pip install -r requirements.txt
RUN apt cache clean
EXPOSE 5000
COPY start.sh /jarvis/
RUN chmod +x start.sh
CMD "./start.sh"

View File

@ -47,10 +47,6 @@ Common errors than I personally encoured during this project, hope this can help
#### Linux : #### Linux :
First be sure to have all those packages installed :
```
sudo apt-get install libfann-dev swig libfann-dev python3-fann2
```
I actually don't know how I solved this but I tried building myself FANN following the instruction I actually don't know how I solved this but I tried building myself FANN following the instruction
from [here](https://github.com/libfann/fann#from-source). Here is some links I found trying to solve the error : from [here](https://github.com/libfann/fann#from-source). Here is some links I found trying to solve the error :
https://stackoverflow.com/questions/51367972/lib-fann2-failed-to-install https://stackoverflow.com/questions/51367972/lib-fann2-failed-to-install

View File

@ -1,5 +1,7 @@
{ {
"PORT": 5000, "PORT": 5000,
"12HOURS-FORMAT": false,
"LANGUAGE": "fr-fr", "LANGUAGE": "fr-fr",
"TTS_VOICE": "marytts:upmc-pierre-hsmm" "TTS_VOICE": "marytts:upmc-pierre-hsmm",
"PAUSE_MUSIC_AFTER_HOTWORD": true
} }

View File

@ -18,7 +18,7 @@ def start():
# Supported : English French German Hungarian Italian Portuguese Swedish # Supported : English French German Hungarian Italian Portuguese Swedish
lingua_franca.load_language(lang=languages_utils.get_language_only_country()) lingua_franca.load_language(lang=languages_utils.get_language_only_country())
# Register all skills # Tests
WikipediaSkill().register() WikipediaSkill().register()
JokesSkill().register() JokesSkill().register()
SpotifySkill().register() SpotifySkill().register()
@ -29,6 +29,7 @@ def start():
HomeAssistantSkill().register() HomeAssistantSkill().register()
MovieMaster().register() MovieMaster().register()
# TODO: movies master skill
# TODO: calculator skill # TODO: calculator skill
# TODO: google/ddg help skill # TODO: google/ddg help skill
# TODO: unit converter skill # TODO: unit converter skill

View File

@ -1,5 +1,4 @@
import json import json
import tempfile
import flask import flask
import speech_recognition as sr import speech_recognition as sr
@ -22,7 +21,6 @@ def process_text_request():
request.headers.get('Client-Port'))) request.headers.get('Client-Port')))
# RAW REQUEST
@app.route("/process_audio_request", methods=['POST']) @app.route("/process_audio_request", methods=['POST'])
def process_audio_request(): def process_audio_request():
frame_data = request.data frame_data = request.data
@ -32,27 +30,8 @@ def process_audio_request():
r = sr.Recognizer() r = sr.Recognizer()
audio = sr.AudioData(frame_data, sample_rate, sample_width) audio = sr.AudioData(frame_data, sample_rate, sample_width)
return recognition(r, audio)
# .WAV (i.e.) FILE REQUEST
@app.route("/process_audio_request_file", methods=['POST'])
def process_audio_request_android():
temp = tempfile.NamedTemporaryFile(prefix='audio_', suffix='_android')
temp.write(request.data)
# use the audio file as the audio source
r = sr.Recognizer()
with sr.AudioFile(temp.name) as source:
audio = r.record(source) # read the entire audio file
temp.close()
return recognition(r, audio)
def recognition(recognizer, audio):
try: try:
result_stt = recognizer.recognize_google(audio, language=languages_utils.get_language_only_country()) result_stt = r.recognize_google(audio, language=languages_utils.get_language_only_country())
return jsonify( return jsonify(
intent_manager.recognise(result_stt, request.headers.get('Client-Ip'), request.headers.get('Client-Port'))) intent_manager.recognise(result_stt, request.headers.get('Client-Ip'), request.headers.get('Client-Port')))

View File

@ -21,11 +21,11 @@ def get_language_only_country():
def get_language_full_name(name=None): def get_language_full_name(name=None):
""" """
Return for exemple french for fr-fr, english for en-en, etc (saved in languages.json in the config folder) Return for exemple french for fr-fr, english for en-en, etc (savec in languages.json in the config folder)
Return english if the language isn't found in the languages.json file Return english if the language isn't found in the languages.json file
""" """
config_json = json.load(open(path + "/utils/config/languages.json", encoding='utf-8', mode='r')) config_json = json.load(open(path + "/config/languages.json", encoding='utf-8', mode='r'))
if name is None: if name is None:
name = get_language() name = get_language()
@ -37,7 +37,7 @@ def get_language_full_name(name=None):
def get_spacy_model(language=None): def get_spacy_model(language=None):
spacy_model = json.load(open(path + "/utils/config/spacy.json", encoding='utf-8', mode='r')) spacy_model = json.load(open(path + "/config/spacy.json", encoding='utf-8', mode='r'))
if language is None: if language is None:
language = get_language() language = get_language()

View File

@ -1,47 +0,0 @@
Ok Google souviens-toi que jai mis les clés [ou nimporte quel objet] à lentrée [ou nimporte quel autre endroit]
Ok Google, où sont mes clés ?
Ok Google, où se trouve mon smartphone / iPhone ?
Ok Google, rappelle-moi de rappeler ma mère à 18 heures
Ok Google, comment dit-on merci en Chinois mandarin ?
Ok Google, traduis “je taime” en japonais
Ok Google, appairage Bluetooth
Ok Google, déconnecte le Bluetooth
Ok Google, mets le minuteur sur 5 minutes
Ok Google, combien de temps reste-t-il sur le minuteur ?
Ok Google, arrête/annule le minuteur
Ok Google, stop (lorsque le minuteur sonne)
Ok Google, mets une alarme à [heure]
Ok Google, annule lalarme
Ok Google, quelle est la définition de [mot]
Ok Google, raconte-moi quelque chose dintéressant
Ok Google, parle à Akinator
Ok Google, raconte-moi une histoire