File size: 1,690 Bytes
ca5173a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python3
"""
Test script for the voice conversation feature.
Run this to test the voice conversation functionality.
"""

import os
import sys

# Add the src directory to the path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))

try:
    from fitness_gradio.ui.app import FitnessAppUI
    
    print("βœ… Successfully imported FitnessAppUI")
    
    # Test creating the app
    app = FitnessAppUI()
    print("βœ… Successfully created FitnessAppUI instance")
    
    # Test getting the demo
    demo = app.get_demo()
    print("βœ… Successfully got Gradio demo")
    
    print("\nπŸŽ‰ Voice conversation feature is ready!")
    print("\nπŸš€ To launch the app, run:")
    print("python scripts/run_gradio.py")
    
    print("\nπŸ“‹ Voice Conversation Features:")
    print("- 🎀 Start Voice Conversation button")
    print("- πŸ”Š Automatic voice activity detection (VAD)")
    print("- πŸ—£οΈ Speech-to-text using Groq Whisper")
    print("- πŸ€– AI responses using your selected model")
    print("- πŸ”‰ Text-to-speech using Groq TTS")
    print("- πŸ’¬ Chat history preserved in main conversation")
    print("- ❌ Exit button to end voice chat")
    
    print("\n⚠️  Requirements:")
    print("- GROQ_API_KEY environment variable must be set")
    print("- Microphone access will be requested by the browser")
    print("- Modern browser with JavaScript enabled")
    
except ImportError as e:
    print(f"❌ Import error: {e}")
    print("\nTry installing missing dependencies:")
    print("pip install gradio groq soundfile")
    
except Exception as e:
    print(f"❌ Error: {e}")
    print("\nPlease check your setup and try again.")