Minor change.
This commit is contained in:
		
							parent
							
								
									b8a517cc14
								
							
						
					
					
						commit
						84c83cfd70
					
				
							
								
								
									
										13
									
								
								tts.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								tts.py
									
									
									
									
									
								
							| @ -37,17 +37,18 @@ async def main(): | |||||||
|     recognizer = sr.Recognizer() |     recognizer = sr.Recognizer() | ||||||
| 
 | 
 | ||||||
|     with sr.Microphone() as source: |     with sr.Microphone() as source: | ||||||
|         print("Adjusting for ambient noise, please wait...") |         print("Adjusting to surroundings for a five seconds.") | ||||||
|         recognizer.adjust_for_ambient_noise(source, duration=1) |         recognizer.adjust_for_ambient_noise(source, duration=5) | ||||||
|         print("Listening...") | 
 | ||||||
| 
 | 
 | ||||||
|         while True: |         while True: | ||||||
|  |             print("Listening...") | ||||||
|             try: |             try: | ||||||
|                 audio_data = recognizer.listen(source, timeout=10) |                 audio_data = recognizer.listen(source, timeout=10) | ||||||
|                 text = recognizer.recognize_google(audio_data, language="en-US") |                 text = recognizer.recognize_google(audio_data, language="nl-NL") #en-US | ||||||
|                 print(f"Recognized Text: {text}") |                 print(f"You said:\n\t{text}") | ||||||
|                 response_llm = molodetz.gpt4o_mini(text) |                 response_llm = molodetz.gpt4o_mini(text) | ||||||
|                 print(f"Response from gpt4o_mini: {response_llm}") |                 print(f"GPT4o mini said:\n\t{response_llm}") | ||||||
|                 await gcloud.tts(response_llm) |                 await gcloud.tts(response_llm) | ||||||
|             except sr.WaitTimeoutError: |             except sr.WaitTimeoutError: | ||||||
|                 continue |                 continue | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user