aheedsajid commited on
Commit
39d4047
Β·
verified Β·
1 Parent(s): 0f4801b

Delete README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -127
README.md DELETED
@@ -1,127 +0,0 @@
1
- # 🎀 Real-time Microphone Streaming Server (Python/Gradio)
2
-
3
- A robust Python backend using Gradio for real-time audio streaming from Android devices, designed for Hugging Face Spaces deployment.
4
-
5
- ## πŸš€ Features
6
-
7
- - **Gradio Web Interface**: Beautiful, real-time dashboard showing connected devices
8
- - **WebSocket Support**: Stable WebSocket connections for Android devices
9
- - **Device Management**: Real-time device registration, monitoring, and control
10
- - **Hugging Face Ready**: Optimized for Hugging Face Spaces deployment
11
- - **Audio Processing**: Handles PCM audio data with base64 encoding
12
- - **Auto-refresh**: Live updates of device status and streaming data
13
-
14
- ## πŸ“ Files
15
-
16
- - `app.py` - Main Gradio application with WebSocket server
17
- - `audio_utils.py` - Audio processing utilities and device management
18
- - `requirements.txt` - Python dependencies
19
- - `README.md` - This file
20
-
21
- ## πŸ—οΈ Deployment on Hugging Face Spaces
22
-
23
- ### Step 1: Create a New Space
24
-
25
- 1. Go to [Hugging Face Spaces](https://huggingface.co/spaces)
26
- 2. Click "Create new Space"
27
- 3. Choose **Gradio** as the SDK
28
- 4. Set your space name (e.g., `realtime-mic-streaming`)
29
- 5. Make it **Public** or **Private** as needed
30
-
31
- ### Step 2: Upload Files
32
-
33
- Upload these files to your Hugging Face Space:
34
- - `app.py`
35
- - `audio_utils.py`
36
- - `requirements.txt`
37
- - `README.md`
38
-
39
- ### Step 3: Configure Android App
40
-
41
- Update your Android app to connect to:
42
- ```
43
- wss://YOUR-USERNAME-SPACE-NAME.hf.space:7861
44
- ```
45
-
46
- For example: `wss://johndoe-realtime-mic-streaming.hf.space:7861`
47
-
48
- ## πŸ”§ Local Development
49
-
50
- To run locally:
51
-
52
- ```bash
53
- pip install -r requirements.txt
54
- python app.py
55
- ```
56
-
57
- - Gradio interface: `http://localhost:7860`
58
- - WebSocket server: `ws://localhost:7861`
59
-
60
- ## πŸ“± Android App Configuration
61
-
62
- Your Android app should connect to the WebSocket URL and send messages in this format:
63
-
64
- ### Device Registration
65
- ```json
66
- {
67
- "type": "register_device",
68
- "device_id": "unique-device-id",
69
- "device_name": "My Android Phone",
70
- "device_model": "Samsung Galaxy S21"
71
- }
72
- ```
73
-
74
- ### Audio Streaming
75
- ```json
76
- {
77
- "type": "audio_chunk",
78
- "timestamp": 1640995200000,
79
- "data": {
80
- "audio_data": "base64-encoded-pcm-audio-data",
81
- "sample_rate": 16000,
82
- "channels": 1,
83
- "format": "pcm_16"
84
- }
85
- }
86
- ```
87
-
88
- ### Heartbeat
89
- ```json
90
- {
91
- "type": "ping"
92
- }
93
- ```
94
-
95
- ## πŸŽ›οΈ Web Interface
96
-
97
- The Gradio interface provides:
98
-
99
- - **Real-time Statistics**: Connected devices, streaming devices, data usage
100
- - **Device List**: Table showing all connected devices with status
101
- - **Stream Control**: Start/stop streaming buttons for individual devices
102
- - **Audio Monitor**: Recent audio chunk activity
103
- - **Connection Info**: WebSocket URL for Android app configuration
104
-
105
- ## πŸ”’ Security Notes
106
-
107
- - This is designed for development/demo use
108
- - For production, add authentication and SSL/TLS
109
- - Consider rate limiting for WebSocket connections
110
- - Validate all incoming audio data
111
-
112
- ## πŸ› Troubleshooting
113
-
114
- ### WebSocket Connection Issues
115
- - Check firewall settings
116
- - Ensure port 7861 is accessible
117
- - Verify WebSocket URL format
118
-
119
- ### Audio Data Issues
120
- - Ensure base64 encoding is correct
121
- - Check audio format (PCM 16-bit)
122
- - Verify sample rate matches expectations
123
-
124
- ### Hugging Face Deployment Issues
125
- - Check logs in the Space's "App" tab
126
- - Verify all dependencies are in requirements.txt
127
- - Ensure app.py is the main entry point