A web application that simulates dynamic debates between two AI agents with distinct personalities - one aggressive (PROS) and one analytical (CONS) - using Google's Gemini API. Users can select topics and experience realistic debate conversations with human-like text-to-speech capabilities.

Debate.mp4
- ๐ฏ Topic Selection: Choose from predefined topics or create custom ones
- ๐ญ Dual Personalities: PROS (aggressive) vs CONS (analytical) AI agents
- ๐ Text-to-Speech: Human-like voices with male (PROS) and female (CONS) voices
- ๐ฎ Interactive Controls: Adjust debate rounds and playback controls
- ๐ฑ Responsive Design: Works on desktop and mobile devices
- ๐จ Modern UI: Beautiful gradient design with smooth animations
- ๐ Real-time Generation: Dynamic debate creation with streaming responses
- Python 3.8+
- Node.js 20.19+ (for building the frontend)
- Google Gemini API key
- ElevenLabs API key (optional, for enhanced voice quality)
cd Yxth# Create virtual environment (if not already created)
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install Python dependencies
pip install -r requirements.txtcd client
npm install
npm run build
cd ..Create a .env file in the root directory:
GOOGLE_API_KEY=your_gemini_api_key_here
ELEVENLABS_API_KEY=your_elevenlabs_api_key_hereYou can get a Gemini API key from Google AI Studio. You can get an ElevenLabs API key from ElevenLabs (optional).
python main.pyThe application will be available at http://localhost:5000
- Select a Topic: Choose from the predefined topics or create a custom one
- Adjust Rounds: Use the slider to set the number of debate rounds (1-5)
- Generate Debate: Click "Generate Conversation" to create the debate
- Listen: Click "Play Conversation" to hear the agents speak with different voices
- Control Playback: Use the stop button to halt the conversation at any time
- Framework: Flask with CORS support
- AI Model: Google Gemini 2.0 Flash
- API Endpoints:
/api/conversation(POST) - Generate debate/api/generate-and-speak(POST) - Stream debate with TTS
- Features: Dynamic debate generation with personality prompts and streaming responses
- Framework: React 19 with TypeScript
- Styling: Custom CSS with modern gradients and animations
- Text-to-Speech: Web Speech API with voice selection
- Responsive: Mobile-first design approach
- Build Tool: Vite for fast development and optimized builds
- PROS Agent: Speaks with passion and conviction, highlighting opportunities and benefits
- CONS Agent: Maintains a critical, analytical tone, revealing risks and drawbacks
- Context Awareness: Both agents respond to each other's arguments in real-time
- PROS Agent: Male voice with higher pitch and faster rate
- CONS Agent: Female voice with lower pitch and normal rate
- Enhanced TTS: Optional ElevenLabs integration for premium voice quality
- Fallback: Uses available English voices if specific voices aren't found
{
"success": true,
"conversation": [
{
"speaker": "pros",
"text": "That's an excellent point! Technology is clearly revolutionizing how we work...",
"round": 1
},
{
"speaker": "cons",
"text": "I understand your enthusiasm, but let me point out some critical concerns...",
"round": 1
}
],
"topic": "Is technology making humans lazy?"
}Edit the predefinedTopics array in client/src/App.tsx:
const predefinedTopics = [
"Your new debate topic here?",
// ... existing topics
];Update the personality prompts in main.py:
pros_prefix = "Your custom PROS personality prompt..."
cons_prefix = "Your custom CONS personality prompt..."Adjust voice parameters in client/src/App.tsx:
utterance.rate = 0.9; // Speech rate (0.1 to 10)
utterance.pitch = 1.1; // Pitch (0 to 2)
utterance.volume = 1; // Volume (0 to 1)- API Key Error: Ensure your
.envfile contains a valid Gemini API key - Voice Not Working: Check if your browser supports the Web Speech API
- CORS Errors: Make sure the Flask server is running on port 5000
- Build Errors: Ensure Node.js version is 20.19+ for Vite compatibility
- Streaming Issues: Check network connectivity for real-time debate generation
- Chrome/Edge: Full support with best TTS experience
- Firefox: Limited TTS support
- Safari: Limited TTS support
Yxth/
โโโ client/ # React frontend
โ โโโ src/ # Source code
โ โโโ dist/ # Built frontend
โ โโโ package.json # Frontend dependencies
โโโ main.py # Flask backend server
โโโ requirements.txt # Python dependencies
โโโ .env # Environment variables
โโโ README.md # This file
This project is open source and available under the MIT License.
Feel free to submit issues and enhancement requests! Contributions are welcome for:
- New debate topics
- Personality improvements
- UI/UX enhancements
- Performance optimizations