Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Docker image

on:
push:
branches:
- master

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5.4.0
with:
images: karlosarr/asistente-local

- name: Build and push Docker image
uses: docker/build-push-action@v5
env:
DOCKER_BUILDKIT: 1
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64
20 changes: 20 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM nvcr.io/nvidia/l4t-pytorch:r35.1.0-pth1.13-py3
LABEL maintainer="Carlos Ruiz <karlosarr[at]protonmail.com>"
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get install qemu-arm-static
RUN apt-get update && \
apt-get --no-install-recommends install -y ffmpeg \
libgtk2.0-0 libgtk2.0-common libportaudio2 \
libportaudiocpp0 portaudio19-dev python3-pyaudio && \
apt-get clean
RUN pip3 install git+https://github.com/openai/whisper.git
RUN pip3 install sounddevice
RUN pip3 install scipy
RUN pip3 install typing-extensions --upgrade
RUN mkdir -p /VA
WORKDIR /VA
COPY ./utils /VA/utils
COPY ./asistente.py /VA/asistente.py
COPY ./config.yaml /VA/config.yaml
COPY ./main.py /VA/main.py
COPY ./requirements.txt /VA/requirements.txt
RUN pip3 install -r ./requirements.txt
CMD python3 ./main.py
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=karlosarr_asistente_local&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=karlosarr_asistente_local)

# Asistente Virtual Local
Proyecto educativo ([Lista de reprodicción en Youtube](https://www.youtube.com/watch?v=SaoDps2QBsI&list=PLA050nq-BHwN5CJuPAsFkBTrW_4Xxso_4)) para poder correr un asistente virtual de manera local. Integra distintos modelos de machine learning para poder brindar distintas funcionalidades.

Expand Down Expand Up @@ -42,6 +44,19 @@ python main.py
```


```
# Ejecutar con docker compose desde la carpeta donde se clono este repositorio en la maquina huesped.
docker compose run --build --rm asistente bash

# Ejecutar aplicación manualmente
python3 ./main.py
```

Ejecutar aplicación sin interación con la línea de comandos
```
docker compose run --build --rm asistente
```

### x86
Ya instalado docker con NVIDIA container toolkit.

Expand All @@ -57,14 +72,24 @@ cd /va
python main.py
```

# Consola interactiva con el contanedor
docker compose run --build --rm asistente bash

ejecutar aplicación manualmente
python3 ./main.py
```

Ejecutar aplicación sin interación con la línea de comandos
```
docker compose run --build --rm asistente
```
## Aportaciones
Este proyecto esta abierto a aportaciones asi que si quieres mejorar o agregar funcionalidades haz un pull request.

# To Do:
- [X] Transcipción en tiempo real
- [X] Detectar palabra clave para que el asistente sepa que se le esta hablando
- [ ] Crear Dockerfile para no requerir pull
- [X] Crear Dockerfile para no requerir pull
- [ ] Modularizar el __init__ de la clase Asistente en distintas funciones
- [ ] API OpenAI GPT-3 (No es local, pero su uso sera limitado)
- [ ] Probar en Jetson Nano
Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3'

services:

asistente:
build:
context: .
container_name: asistente
restart: always
runtime: nvidia
network_mode: "host"
stdin_open: true
tty: true
devices:
- /dev/snd:/dev/snd
ports:
- 8080:8080
environment:
- NVIDIA_VISIBLE_DEVICES=all
volumes:
- ./:/VA
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pyyaml~=6.0
SpeechRecognition~=3.10
openai~=1.6.0
gtts~=2.5.0
pygame~=2.5.2
#python3-pyaudio~=0.2.14
14 changes: 14 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sonar.projectKey=karlosarr_asistente_local
sonar.organization=karlosarr

# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=asistente_local
#sonar.projectVersion=1.0


# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
sonar.sources=.

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
sonar.python.version=3.8