gchhablani commited on
Commit
c5c3fcc
1 Parent(s): 6e35e89

Remove PyTTS3

Browse files
Files changed (1) hide show
  1. apps/mic.py +17 -17
apps/mic.py CHANGED
@@ -4,7 +4,7 @@ import streamlit as st
4
  import numpy as np
5
  import pandas as pd
6
  import os
7
- import pyttsx3
8
  import matplotlib.pyplot as plt
9
  import re
10
  from mtranslate import translate
@@ -24,10 +24,10 @@ from streamlit import caching
24
 
25
  def app(state):
26
  mic_state = state
27
- engine = pyttsx3.init()
28
- engine.setProperty('rate', 100)
29
- voices = engine.getProperty('voices')
30
- engine.setProperty('voice', voices[1].id)
31
  with st.beta_expander("Usage"):
32
  st.write(read_markdown("usage.md"))
33
  st.write("\n")
@@ -141,21 +141,21 @@ def app(state):
141
  "**English Translation**: "+ sequence[0] if lang_id=="en" else translate(sequence[0])
142
  )
143
 
144
- try:
145
- clean_text = re.sub(r'[^A-Za-z0-9 ]+', '', sequence[0])
146
- engine.say(clean_text)
147
- engine.runAndWait()
148
- engine.stop()
149
 
150
- engine.save_to_file(clean_text, 'temp.mp3')
151
- engine.runAndWait()
152
 
153
 
154
- audio_file = open('temp.mp3', 'rb')
155
- audio_bytes = audio_file.read()
156
- st.audio(audio_bytes, format='audio/mp3')
157
- except:
158
- pass
159
 
160
 
161
 
 
4
  import numpy as np
5
  import pandas as pd
6
  import os
7
+ # import pyttsx3
8
  import matplotlib.pyplot as plt
9
  import re
10
  from mtranslate import translate
 
24
 
25
  def app(state):
26
  mic_state = state
27
+ # engine = pyttsx3.init()
28
+ # engine.setProperty('rate', 100)
29
+ # voices = engine.getProperty('voices')
30
+ # engine.setProperty('voice', voices[1].id)
31
  with st.beta_expander("Usage"):
32
  st.write(read_markdown("usage.md"))
33
  st.write("\n")
 
141
  "**English Translation**: "+ sequence[0] if lang_id=="en" else translate(sequence[0])
142
  )
143
 
144
+ # try:
145
+ # clean_text = re.sub(r'[^A-Za-z0-9 ]+', '', sequence[0])
146
+ # engine.say(clean_text)
147
+ # engine.runAndWait()
148
+ # engine.stop()
149
 
150
+ # engine.save_to_file(clean_text, 'temp.mp3')
151
+ # engine.runAndWait()
152
 
153
 
154
+ # audio_file = open('temp.mp3', 'rb')
155
+ # audio_bytes = audio_file.read()
156
+ # st.audio(audio_bytes, format='audio/mp3')
157
+ # except:
158
+ # pass
159
 
160
 
161