meraj12 commited on
Commit
037d23a
·
verified ·
1 Parent(s): ffdb7d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -10,12 +10,15 @@ import pyttsx3
10
  import os
11
  from datetime import datetime
12
  import torch
13
- from torchvision.models.mobilenetv2 import MobileNetV2
 
14
  # ========== TTS ENGINE ==========
15
- def speak(text):
16
- engine = pyttsx3.init()
17
- engine.say(text)
18
- engine.runAndWait()
 
 
19
 
20
  # ========== CURRENCY TYPE ==========
21
  currency_type = st.selectbox("Select currency type:", ["PKR (Pakistani Rupees)", "USD (US Dollars)", "INR (Indian Rupees)"])
 
10
  import os
11
  from datetime import datetime
12
  import torch
13
+ from torchvision.models.mobilenetv2 import MobileNetV2
14
+ from gtts import gTTS
15
  # ========== TTS ENGINE ==========
16
+
17
+ def speak_streamlit(text):
18
+ tts = gTTS(text=text, lang='en')
19
+ tts.save("temp.mp3")
20
+ st.audio("temp.mp3", format="audio/mp3")
21
+
22
 
23
  # ========== CURRENCY TYPE ==========
24
  currency_type = st.selectbox("Select currency type:", ["PKR (Pakistani Rupees)", "USD (US Dollars)", "INR (Indian Rupees)"])