ftshijt commited on
Commit
1f48149
·
verified ·
1 Parent(s): 01bcf7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -40,8 +40,11 @@ print(f"Current working directory: {os.getcwd()}")
40
  print(f"Data directory permissions: {oct(os.stat(DATA_DIR).st_mode)}")
41
  print(f"NLTK data directory permissions: {oct(os.stat(nltk_data_dir).st_mode) if os.path.exists(nltk_data_dir) else 'Not found'}")
42
 
 
 
 
 
43
  def convert_python_dict_to_json(py_dict_str):
44
- # This is a simplified approach and might need further refinement
45
  result = py_dict_str
46
 
47
  # Handle dictionary keys
@@ -363,7 +366,8 @@ def evaluate_audio(gt_file, pred_file, metric_config, include_timestamps=False):
363
  output_file_result = f.read().strip()
364
  print(convert_python_dict_to_json(output_file_result))
365
  results = json.loads(convert_python_dict_to_json(output_file_result))
366
-
 
367
  # Format results as DataFrame
368
  if results:
369
  results_df = pd.DataFrame([results])
 
40
  print(f"Data directory permissions: {oct(os.stat(DATA_DIR).st_mode)}")
41
  print(f"NLTK data directory permissions: {oct(os.stat(nltk_data_dir).st_mode) if os.path.exists(nltk_data_dir) else 'Not found'}")
42
 
43
+ # Custom function to handle mixed data types
44
+ def format_value(value):
45
+ return f"{value:.2f}" if isinstance(value, float) else value
46
+
47
  def convert_python_dict_to_json(py_dict_str):
 
48
  result = py_dict_str
49
 
50
  # Handle dictionary keys
 
366
  output_file_result = f.read().strip()
367
  print(convert_python_dict_to_json(output_file_result))
368
  results = json.loads(convert_python_dict_to_json(output_file_result))
369
+
370
+ results = {key: format_value(value) for key, value in results.items()}
371
  # Format results as DataFrame
372
  if results:
373
  results_df = pd.DataFrame([results])