This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend
What I Built
I built MockMate, a voice-powered mock interview partner designed for a close friend who gets severe interview anxiety during technical and behavioral rounds. It simulates a live hiring manager, reads interview questions out loud using natural voice synthesis, and guides them through a realistic conversational feedback loop to help them practice speaking their answers aloud.
Demo
- Live App: MockMate on Replit
How I Built It
- Frontend & Runtime: Built with Python and Streamlit for rapid UI development and seamless session state tracking.
-
Voice & Audio Processing: Integrated the ElevenLabs API to translate generated interview prompts into realistic, high-quality audio streams (
st.audio). - Cloud Hosting: Deployed and hosted live using Render / Replit to make the app accessible anywhere.
- Development Environment: Architected completely inside browser-based developer tools using Replit.
Why Does Open Innovation Matter?
Open-source frameworks and open APIs allow developers to completely decouple user interfaces from proprietary vendors. For an application handling sensitive career data like targeted job descriptions, past employment backgrounds, and vulnerable mock interview answers, utilizing flexible cloud runtimes and open modular tooling ensures that developers retain full control over data pathways, audio pipelines, and model customizations without vendor lock-in.
Prize Categories
- Best Use of Render
- Best Use of ElevenLabs
Code
python
import os
import streamlit as st
import requests
# Page Config
st.set_page_config(page_title="MockMate - AI Interview Partner", page_icon="🎙️", layout="centered")
st.title("🎙️ MockMate")
st.caption("Your personal, voice-powered AI interview coach. Built for a friend.")
# Sidebar for settings & API keys
with st.sidebar:
st.header("Configuration")
target_role = st.text_input("Target Role", "Frontend Developer")
job_desc = st.text_area("Paste Job Description", "Looking for a React developer with 3+ years experience...")
# ElevenLabs configuration
elevenlabs_api_key = st.text_input("ElevenLabs API Key", type="password")
voice_id = st.text_input("ElevenLabs Voice ID", "21m00Tcm4TlvDq8ikWAM") # Default Rachel voice
# Initialize session state for conversation history
if "messages" not in st.session_state:
st.session_state.messages = []
# Function to generate ElevenLabs Audio
def text_to_speech(text, api_key, voice_id):
url = f"[https://api.elevenlabs.io/v1/text-to-speech/](https://api.elevenlabs.io/v1/text-to-speech/){voice_id}"
headers = {
"Accept": "audio/mpeg",
"Content-Type": "application/json",
"xi-api-key": api_key
}
data = {
"text": text,
"model_id": "eleven_monolingual_v1",
"voice_settings": {"stability": 0.5, "similarity_boost": 0.5}
}
response = requests.post(url, json=data, headers=headers)
if response.status_code == 200:
return response.content
return None
# Start Interview Button
if not st.session_state.messages:
if st.button("Start Mock Interview"):
initial_question = f"Hello! Let's start your mock interview for the {target_role} position. To kick things off, can you tell me about yourself and your relevant experience?"
st.session_state.messages.append({"role": "assistant", "content": initial_question})
st.rerun()
# Display chat history
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.write(message["content"])
if message["role"] == "assistant" and elevenlabs_api_key:
audio_bytes = text_to_speech(message["content"], elevenlabs_api_key, voice_id)
if audio_bytes:
st.audio(audio_bytes, format="audio/mp3")
# User Input
user_input = st.chat_input("Type your answer here...")
if user_input:
st.session_state.messages.append({"role": "user", "content": user_input})
with st.chat_message("user"):
st.write(user_input)
# Generate next mock interview question
next_question = f"Thank you for that answer. Based on the job description for {target_role}, how do you handle debugging complex performance issues under a tight deadline?"
st.session_state.messages.append({"role": "assistant", "content": next_question})
with st.chat_message("assistant"):
st.write(next_question)
if elevenlabs_api_key:
audio_bytes = text_to_speech(next_question, elevenlabs_api_key, voice_id)
if audio_bytes:
st.audio(audio_bytes, format="audio/mp3")
st.rerun()
Top comments (0)