Pranav Mishra Claude commited on
Commit
e46f847
·
1 Parent(s): fdb6ca6

Fix audio processing libraries for HF Spaces v1.1.0

Browse files

- Add pydub, ffmpeg-python, audioread, resampy to requirements_hf.txt
- Update API version to 1.1.0
- Fix audio corruption issues causing poor ML predictions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +4 -4
  2. requirements_hf.txt +6 -0
app.py CHANGED
@@ -95,7 +95,7 @@ def index():
95
  return jsonify({
96
  'message': 'Streaming Digit Classifier API',
97
  'status': 'running',
98
- 'version': '1.0.0',
99
  'available_processors': list(processors.keys()),
100
  'documentation': 'Frontend at Vercel, Backend API at HF Spaces'
101
  })
@@ -173,7 +173,7 @@ def process_audio():
173
  result.update({
174
  'audio_duration': round(duration, 3),
175
  'file_size': len(audio_data),
176
- 'api_version': '1.0.0'
177
  })
178
 
179
  app.logger.info(f"Processed audio with {method}: '{result['predicted_digit']}' in {result['inference_time']}s")
@@ -231,7 +231,7 @@ def process_audio_chunk():
231
  'segment_index': 0,
232
  'segment_size': len(standardized_audio),
233
  'is_streaming': True,
234
- 'api_version': '1.0.0'
235
  })
236
 
237
  app.logger.info(f"Streaming prediction: '{result['predicted_digit']}' "
@@ -294,7 +294,7 @@ def health_check():
294
  'status': 'healthy',
295
  'timestamp': time.time(),
296
  'processors': processor_health,
297
- 'version': '1.0.0',
298
  'deployment': 'huggingface-spaces'
299
  })
300
 
 
95
  return jsonify({
96
  'message': 'Streaming Digit Classifier API',
97
  'status': 'running',
98
+ 'version': '1.1.0',
99
  'available_processors': list(processors.keys()),
100
  'documentation': 'Frontend at Vercel, Backend API at HF Spaces'
101
  })
 
173
  result.update({
174
  'audio_duration': round(duration, 3),
175
  'file_size': len(audio_data),
176
+ 'api_version': '1.1.0'
177
  })
178
 
179
  app.logger.info(f"Processed audio with {method}: '{result['predicted_digit']}' in {result['inference_time']}s")
 
231
  'segment_index': 0,
232
  'segment_size': len(standardized_audio),
233
  'is_streaming': True,
234
+ 'api_version': '1.1.0'
235
  })
236
 
237
  app.logger.info(f"Streaming prediction: '{result['predicted_digit']}' "
 
294
  'status': 'healthy',
295
  'timestamp': time.time(),
296
  'processors': processor_health,
297
+ 'version': '1.1.0',
298
  'deployment': 'huggingface-spaces'
299
  })
300
 
requirements_hf.txt CHANGED
@@ -11,6 +11,12 @@ librosa==0.10.1
11
  scipy==1.11.0
12
  soundfile==0.12.1
13
 
 
 
 
 
 
 
14
  # ML Models - PyTorch CPU
15
  torch==2.0.1
16
  torchaudio==2.0.2
 
11
  scipy==1.11.0
12
  soundfile==0.12.1
13
 
14
+ # Critical Audio Processing Libraries (Fix audio corruption)
15
+ pydub==0.25.1
16
+ ffmpeg-python==0.2.0
17
+ audioread==3.0.0
18
+ resampy==0.4.2
19
+
20
  # ML Models - PyTorch CPU
21
  torch==2.0.1
22
  torchaudio==2.0.2