Spaces:
Running
Running
Michael Natanael
commited on
Commit
·
b6ae325
1
Parent(s):
499cbc6
- add truncation=True to bert_predict to ensure input ≤512 tokens
Browse files- app.py +1 -0
- templates/transcribe.html +2 -2
app.py
CHANGED
@@ -86,6 +86,7 @@ def bert_predict(input_lyric):
|
|
86 |
input_lyric,
|
87 |
add_special_tokens=True,
|
88 |
max_length=512,
|
|
|
89 |
return_token_type_ids=True,
|
90 |
padding="max_length",
|
91 |
return_attention_mask=True,
|
|
|
86 |
input_lyric,
|
87 |
add_special_tokens=True,
|
88 |
max_length=512,
|
89 |
+
truncation=True, # Ensures input ≤512 tokens
|
90 |
return_token_type_ids=True,
|
91 |
padding="max_length",
|
92 |
return_attention_mask=True,
|
templates/transcribe.html
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
<div class="mt-4 mb-5">
|
21 |
<h2 class="text-lg font-semibold text-gray-800">Predicted Age Group</h2>
|
22 |
<span class="text-center text-lg font-extrabold text-slate-900 sm:text-2xl">
|
23 |
-
{{ prediction }}
|
24 |
</span>
|
25 |
</div>
|
26 |
|
@@ -34,7 +34,7 @@
|
|
34 |
{% for label, prob in probabilities %}
|
35 |
<tr class="{{ 'bg-green-500' if label == prediction else '' }}">
|
36 |
<td class="px-2 text-left">
|
37 |
-
<span class="capitalize text-gray-600 text-1xl sm:text-lg {{ 'font-medium' if label == prediction else '' }}">{{ label }}</span>
|
38 |
</td>
|
39 |
<td class="px-5"></td>
|
40 |
<td class="px-2 text-right">
|
|
|
20 |
<div class="mt-4 mb-5">
|
21 |
<h2 class="text-lg font-semibold text-gray-800">Predicted Age Group</h2>
|
22 |
<span class="text-center text-lg font-extrabold text-slate-900 sm:text-2xl">
|
23 |
+
{{ prediction.upper() }}
|
24 |
</span>
|
25 |
</div>
|
26 |
|
|
|
34 |
{% for label, prob in probabilities %}
|
35 |
<tr class="{{ 'bg-green-500' if label == prediction else '' }}">
|
36 |
<td class="px-2 text-left">
|
37 |
+
<span class="capitalize text-gray-600 text-1xl sm:text-lg {{ 'font-medium' if label == prediction else '' }}">{{ label.capitalize() }}</span>
|
38 |
</td>
|
39 |
<td class="px-5"></td>
|
40 |
<td class="px-2 text-right">
|