Skip to content

Commit

Permalink
Added dockerfile. Need to get local host working in Ollama
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasFavarao committed Nov 21, 2024
1 parent 4745d3f commit 73d9959
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 13 deletions.
18 changes: 18 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:18.04

WORKDIR /tmp

COPY ./entrypoint.sh /tmp/entrypoint.sh

EXPOSE 11434

RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y curl wget nano vim
RUN curl -fsSL https://ollama.com/install.sh | sh
RUN chmod +x entrypoint.sh

CMD ["bash"]


## USE THIS TO BOOT IN BASH " docker run -it --rm -p 11434:11434 tp_llm "
##docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

ollama serve
sleep 5
ollama run qwen:0.5b
48 changes: 35 additions & 13 deletions tts.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
from gtts import gTTS

LANGUAGE = "en"

def ttsGenerate(textStr):
ttsObj = gTTS(text = textStr, lang = LANGUAGE, slow= False)
ttsObj.save("tempFile.mp3")

print("Enter Text to Generate")

textToGen = input()

ttsGenerate(textToGen)
import pyttsx3 as tts
from LLM import textGeneration
##import pygame
import os
import time
#I chose sapi5 because it can be generated offline
ttsEngine = tts.init(driverName='sapi5')

##pygame.mixer.init()

while(True):
print("Please enter prompt")
textToGen = input()
generatedText = textGeneration(textToGen)
print("this is the response\n" + generatedText['message']['content'])
ttsEngine.save_to_file(text=generatedText['message']['content'],filename="tempfile.mp3")
ttsEngine.runAndWait()
if ttsEngine.isBusy():
time.sleep(1)


"""
pygame.mixer.music.load("tempfile.mp3")
pygame.mixer.music.play()
while pygame.mixer.music.get_busy():
time.sleep(1)
pygame.mixer.music.stop()
pygame.mixer.music.unload()
if os.path.exists("tempfile.mp3"):
os.remove("tempfile.mp3")
else:
print("file not found")
"""

#The below script is for playing the audio on the system

"""
text = "Hello world, I am a tts test"
Expand Down

0 comments on commit 73d9959

Please sign in to comment.