slslslrhfem commited on
Commit
e17c464
·
1 Parent(s): d01a52c

change download mechanism

Browse files
Files changed (1) hide show
  1. app.py +28 -23
app.py CHANGED
@@ -368,7 +368,7 @@ def process_audio_for_matching(audio_file):
368
  for i, match in enumerate(matches[:3]):
369
  rank = match.get('rank', 0)
370
  song_title = match.get('song_title', 'Unknown Song')
371
- confidence = match.get('confidence', '0%')
372
  test_time = match.get('test_time', 0)
373
  test_time2 = match.get('test_time2', 0)
374
  library_time = match.get('library_time', 0)
@@ -381,30 +381,34 @@ def process_audio_for_matching(audio_file):
381
  matches_html += f"""
382
  <div style="background: #ffffff; border-radius: 8px; padding: 15px; margin: 10px 0;
383
  border-left: 4px solid {rank_color}; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
384
- <div style="display: flex; justify-content: space-between; align-items: flex-start;">
385
- <div style="flex: 1; min-width: 0; margin-right: 15px;">
386
- <h4 style="color: #111827; margin: 0; font-size: 1.1em; word-wrap: break-word; overflow-wrap: break-word;">
387
- <span style="background: {rank_color}; color: white; padding: 2px 6px; border-radius: 10px; font-size: 0.8em; margin-right: 8px;">
388
- #{rank}
389
- </span>
390
- {song_title}
391
- </h4>
392
- </div>
393
- <div style="display: flex; gap: 15px; align-items: center; flex-shrink: 0;">
394
- <div style="text-align: center;">
395
- <small style="color: #6b7280;">Your Segment</small>
396
- <div style="color: #dc2626; font-weight: 600; font-size: 0.9em;">
397
- {format_time(test_time)} - {format_time(test_time2)}
398
- </div>
 
399
  </div>
400
- <div style="text-align: center;">
401
- <small style="color: #6b7280;">Matched Segment</small>
402
- <div style="color: #16a34a; font-weight: 600; font-size: 0.9em;">
403
- {format_time(library_time)} - {format_time(library_time2)}
404
- </div>
405
  </div>
406
- <div style="background: #f3f4f6; color: #111827; padding: 4px 10px; border-radius: 12px; font-weight: 600; font-size: 0.9em;">
407
- {confidence}
 
 
 
408
  </div>
409
  </div>
410
  </div>
@@ -418,6 +422,7 @@ def process_audio_for_matching(audio_file):
418
  <h3 style="color: #111827; margin: 0;">Vocal Matching Results</h3>
419
  <p style="color: #6b7280; margin: 5px 0;">Found {len(matches)} similar vocals in Covers80 dataset</p>
420
  <p style="color: #2563eb; margin: 5px 0; font-size: 0.9em;">🎵 Listen to original songs and extracted segments</p>
 
421
  </div>
422
  {matches_html}
423
  </div>
 
368
  for i, match in enumerate(matches[:3]):
369
  rank = match.get('rank', 0)
370
  song_title = match.get('song_title', 'Unknown Song')
371
+ score = match.get('score', 0) # Raw score instead of confidence
372
  test_time = match.get('test_time', 0)
373
  test_time2 = match.get('test_time2', 0)
374
  library_time = match.get('library_time', 0)
 
381
  matches_html += f"""
382
  <div style="background: #ffffff; border-radius: 8px; padding: 15px; margin: 10px 0;
383
  border-left: 4px solid {rank_color}; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
384
+ <!-- Title -->
385
+ <div style="text-align: center; margin-bottom: 15px;">
386
+ <h4 style="color: #111827; margin: 0; font-size: 1.1em; word-wrap: break-word; overflow-wrap: break-word;">
387
+ <span style="background: {rank_color}; color: white; padding: 2px 6px; border-radius: 10px; font-size: 0.8em; margin-right: 8px;">
388
+ #{rank}
389
+ </span>
390
+ {song_title}
391
+ </h4>
392
+ </div>
393
+
394
+ <!-- Stats -->
395
+ <div style="display: flex; justify-content: space-around; text-align: center;">
396
+ <div>
397
+ <small style="color: #6b7280; display: block; margin-bottom: 2px;">Your Segment</small>
398
+ <div style="color: #dc2626; font-weight: 600; font-size: 0.9em;">
399
+ {format_time(test_time)} - {format_time(test_time2)}
400
  </div>
401
+ </div>
402
+ <div>
403
+ <small style="color: #6b7280; display: block; margin-bottom: 2px;">Matched Segment</small>
404
+ <div style="color: #16a34a; font-weight: 600; font-size: 0.9em;">
405
+ {format_time(library_time)} - {format_time(library_time2)}
406
  </div>
407
+ </div>
408
+ <div>
409
+ <small style="color: #6b7280; display: block; margin-bottom: 2px;">Score</small>
410
+ <div style="background: #f3f4f6; color: #111827; padding: 4px 10px; border-radius: 12px; font-weight: 600; font-size: 0.9em; display: inline-block;">
411
+ {score:.1f}
412
  </div>
413
  </div>
414
  </div>
 
422
  <h3 style="color: #111827; margin: 0;">Vocal Matching Results</h3>
423
  <p style="color: #6b7280; margin: 5px 0;">Found {len(matches)} similar vocals in Covers80 dataset</p>
424
  <p style="color: #2563eb; margin: 5px 0; font-size: 0.9em;">🎵 Listen to original songs and extracted segments</p>
425
+ <p style="color: #9ca3af; margin: 5px 0; font-size: 0.85em;">💡 Scores above 60 generally indicate meaningful similarity for me haha..</p>
426
  </div>
427
  {matches_html}
428
  </div>