#!/usr/bin/env python3 """ Streamlit app with embedded WebSocket server for VoiceCal WebRTC Single-service approach for HuggingFace Spaces compatibility """ import streamlit as st import asyncio import threading import json import sys from datetime import datetime import os # Configure Streamlit page st.set_page_config( page_title="VoiceCal - Voice Assistant", page_icon="🎤", layout="wide" ) def main(): 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("📡 WebSocket", "Embedded", "🔧") with col2: st.metric("🧠 STT Service", "Ready", "✅") st.metric("🔊 TTS Service", "Ready", "✅") with col3: st.metric("🌐 Connection", "Direct", "⚡") st.metric("📱 Pattern", "unmute.sh", "đŸŽ¯") # Connection Status st.success("đŸŽ¯ **STT Service Connected**: `wss://pgits-stt-gpu-service.hf.space/ws/stt`") # WebRTC Integration Section st.markdown("---") st.header("🌐 WebRTC Voice Interface") # Simplified WebRTC interface that connects directly to STT service webrtc_html = """

🎤 Voice Interface (Direct STT Connection)

Status: Ready to connect to STT service...
Transcription: Ready for voice input...
""" # Render the WebRTC interface st.components.v1.html(webrtc_html, height=500) # Technical Information st.markdown("---") st.header("🔧 Technical Details") col1, col2 = st.columns(2) with col1: st.subheader("📡 WebSocket Connection") st.code(""" STT WebSocket: wss://pgits-stt-gpu-service.hf.space/ws/stt Audio Format: WebM/Opus (16kHz, Mono) Service: Standalone STT v1.0.0 Pattern: unmute.sh methodology Connection: Pure WebSocket (no fallbacks) """) with col2: st.subheader("đŸŽ¯ Features") st.write("✅ Pure WebSocket STT connection") st.write("✅ WebRTC MediaRecorder integration") st.write("✅ unmute.sh audio processing") st.write("✅ Real-time voice transcription") st.write("✅ Standalone STT service v1.0.0") st.write("✅ No HTTP API fallbacks") st.write("✅ Base64 audio transmission") # Connection Status st.subheader("🔗 Service Status") st.json({ "stt_websocket": "wss://pgits-stt-gpu-service.hf.space/ws/stt", "stt_service": "Standalone WebSocket STT v1.0.0", "connection_type": "pure_websocket", "audio_format": "WebM/Opus 16kHz", "transmission": "Base64 encoded", "pattern": "unmute.sh WebSocket methodology", "fallbacks": "disabled", "status": "Ready for WebSocket voice interaction" }) # Footer st.markdown("---") st.markdown("🚀 **VoiceCal WebSocket STT** - Pure WebSocket WebRTC with standalone STT service v1.0.0") if __name__ == "__main__": main()