mgokg commited on
Commit
3749801
·
verified ·
1 Parent(s): d7ffdf6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -8,7 +8,7 @@ from langchain.text_splitter import RecursiveCharacterTextSplitter
8
  import os
9
  import speech_recognition as sr
10
  from groq import Groq
11
-
12
  groq= os.getenv('groq')
13
  # Initialisiere ChromaDB
14
  client_chroma = chromadb.Client()
@@ -43,6 +43,16 @@ def update(json):
43
  data = response.json()
44
  response_content = data['choices'][0]['message']['content']
45
 
 
 
 
 
 
 
 
 
 
 
46
  client = Client("Qwen/Qwen2.5-72B-Instruct")
47
 
48
  # Function to transcribe audio data to text
@@ -66,6 +76,7 @@ def transcribe_audio(audio):
66
  #tts = gTTS(text=result, lang='de')
67
  #tts.save("./chroma/output.mp3")
68
  #os.system("start ./chroma/output.mp3") # Dies spielt die Audiodatei ab
 
69
  return result
70
  #text = update(text)
71
  #return text
 
8
  import os
9
  import speech_recognition as sr
10
  from groq import Groq
11
+ import pyttsx3
12
  groq= os.getenv('groq')
13
  # Initialisiere ChromaDB
14
  client_chroma = chromadb.Client()
 
43
  data = response.json()
44
  response_content = data['choices'][0]['message']['content']
45
 
46
+
47
+ def text_to_speech(text):
48
+ engine = pyttsx3.init()
49
+ engine.say(text)
50
+ engine.runAndWait()
51
+
52
+
53
+ text_to_speech(text)
54
+
55
+
56
  client = Client("Qwen/Qwen2.5-72B-Instruct")
57
 
58
  # Function to transcribe audio data to text
 
76
  #tts = gTTS(text=result, lang='de')
77
  #tts.save("./chroma/output.mp3")
78
  #os.system("start ./chroma/output.mp3") # Dies spielt die Audiodatei ab
79
+ text_to_speech(result)
80
  return result
81
  #text = update(text)
82
  #return text