Spaces:
Sleeping
Sleeping
| import pyttsx3 | |
| def text_to_speech(text: str): | |
| # Initialize engine | |
| engine = pyttsx3.init() | |
| # Use default voice | |
| engine.setProperty('voice', engine.getProperty('voices')[0].id) | |
| # Speak the text | |
| engine.say(text) | |
| engine.runAndWait() | |
| # Example usage | |
| if __name__ == "__main__": | |
| text_to_speech("Hello Abdul Moiz! This is your Riaya Tech project speaking.") | |