diff --git a/.gitea/workflows/deploy_via_docker_compose.yml b/.gitea/workflows/deploy_via_docker_compose.yml new file mode 100644 index 0000000..dfa8058 --- /dev/null +++ b/.gitea/workflows/deploy_via_docker_compose.yml @@ -0,0 +1,18 @@ +name: Gitea Docker Redeploy +run-name: ${{ gitea.actor }} is deploying new version +on: [push] + +jobs: + Explore-Gitea-Actions: + #runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" + + - name: List files in the repository + run: | + ls ~ + + - run: echo "🍏 This job's status is ${{ job.status }}." + + diff --git a/README.md b/README.md index 86d8fa4..3ca968a 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,18 @@ sudo docker rmi $(sudo docker images -f "dangling=true" -q) +Give just the translation of the given input to German and nothing else. + + +Give the JSON of a graph linking Germanys 9 biggest cities + + + + + + + + + + + diff --git a/backend/Dockerfile b/backend/Dockerfile index 6ce6299..bd7d40c 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,5 +1,10 @@ FROM python:3.12 -RUN apt-get update && apt-get install -y firefox-esr + +RUN apt-get update +RUN apt-get install -y firefox-esr +RUN apt-get install -y ffmpeg +RUN apt-get install -y espeak-ng + #RUN curl https://ollama.ai/install.sh | sh #RUN ollama run llama2 diff --git a/backend/app.py b/backend/app.py index c2ebd8c..1bfc9b8 100644 --- a/backend/app.py +++ b/backend/app.py @@ -64,6 +64,10 @@ from funcs import group_by from elastictools import get_by_id, update_by_id, delete_by_id from models import QueryLog, Chatbot, User +import pyttsx3 + +engine = pyttsx3.init() + #LLM_PAYLOAD = int(os.getenv("LLM_PAYLOAD")) @@ -335,6 +339,53 @@ def login(form: LoginRequest): #-----bot routes------ + +class GetSpeechRequest(BaseModel): + text: str = Field(None, description="Some text to convert to mp3") + + +@app.post('/text2speech', summary="", tags=[], security=security) +@uses_jwt() +def text2speech(form: GetSpeechRequest, decoded_jwt, user): + + #def get_voice(s): + # for v in engine.getProperty("voices"): + # if s == v.id: + # return v + + #def set_voice(v): + # engine.setProperty("voice", v.id) + + #def set_volume(n): + # engine.setProperty('volume', engine.getProperty('volume') + n) + + #def set_rate(n): + # engine.setProperty('rate', engine.getProperty('rate') + n) + + + + + #voices = engine.getProperty('voices') + #engine.setProperty('voice', voices[1].id) + #set_voice(get_voice("english")) + #set_volume(-5.0) + #set_rate(-40) + + # Speak the response + #engine.say(response) + #ngine.say("Hello World!") + #engine.say("Neuroscience!") + + + file_name = 'speech.mp3' + engine.save_to_file(form.text, file_name) + engine.runAndWait() + return send_file(file_name) #, mimetype = 'zip', attachment_filename= 'Audiofiles.zip', as_attachment = True) + + + + + class GetBotRequest(BaseModel): id: str = Field(None, description="The bot's id") diff --git a/backend/public/index.html b/backend/public/index.html index 9bef2c5..2cfa6fb 100644 --- a/backend/public/index.html +++ b/backend/public/index.html @@ -1,20 +1,27 @@
-