#!/usr/bin/env python3 """ VoiceCal Streamlit App with WebRTC Integration (unmute.sh pattern) """ import streamlit as st import sys from datetime import datetime import os import asyncio import json def main(): st.set_page_config( page_title="VoiceCal - Voice Assistant", page_icon="🎤", layout="wide" ) st.title("🎤📅 VoiceCal - Voice-Enabled AI Assistant") st.markdown("**WebRTC Voice Integration Following unmute.sh Pattern**") # Service status dashboard col1, col2, col3 = st.columns(3) with col1: st.metric("🎤 VoiceCal", "Online", "✅") st.metric("📡 WebRTC", "Ready", "🔄") with col2: st.metric("🧠 STT Service", "Available", "✅") st.metric("🔊 TTS Service", "Available", "✅") with col3: st.metric("🌐 WebSocket", "Initializing", "âŗ") st.metric("📱 Client", "Pending", "🔌") # WebRTC Integration Section st.markdown("---") st.header("🌐 WebRTC Voice Integration") # JavaScript for WebRTC implementation following unmute.sh pattern webrtc_html = """

🎤 Voice Interface (unmute.sh Pattern)

Status: Initializing WebRTC connection...
Transcription: Ready for voice input...
""" # Render the WebRTC interface st.components.v1.html(webrtc_html, height=600) # Technical Information st.markdown("---") st.header("🔧 Technical Details") col1, col2 = st.columns(2) with col1: st.subheader("📡 WebRTC Configuration") st.code(f""" WebSocket URL: wss://pgits-voicecal.hf.space/ws/webrtc/{{client_id}} STT Endpoint: wss://pgits-stt-gpu-service.hf.space/ws/stt TTS Endpoint: wss://pgits-tts-gpu-service.hf.space/ws/tts Audio Format: WebM/Opus (16kHz, Mono) Chunk Size: 250ms (unmute.sh pattern) """) with col2: st.subheader("đŸŽ¯ Features") st.write("✅ Real-time audio streaming") st.write("✅ WebRTC MediaRecorder integration") st.write("✅ unmute.sh pattern implementation") st.write("✅ Automatic chunking & buffering") st.write("✅ Flush trick for end-of-stream") st.write("✅ Bidirectional voice communication") # Connection Status st.subheader("🔗 Service Endpoints") st.json({ "voicecal_websocket": f"wss://pgits-voicecal.hf.space/ws/webrtc/demo-xxxx", "stt_service": "wss://pgits-stt-gpu-service.hf.space/ws/stt", "tts_service": "wss://pgits-tts-gpu-service.hf.space/ws/tts", "pattern": "unmute.sh WebRTC implementation", "status": "Ready for voice interaction" }) # Footer st.markdown("---") st.markdown("🚀 **VoiceCal WebRTC Integration** - Following unmute.sh pattern for optimal voice processing") if __name__ == "__main__": main()