Spaces:
Runtime error
Runtime error
Commit
•
5b14b96
1
Parent(s):
47e00f6
Update app v0.5
Browse files
app.py
CHANGED
@@ -12,11 +12,12 @@ def lyrics_categories(input_text):
|
|
12 |
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
13 |
predictions = predictions.detach().numpy()[0]
|
14 |
predictions = predictions * 100
|
15 |
-
index_sorted = np.argsort(predictions)
|
16 |
clean_outputs = {label[idx]:predictions[idx] for idx in index_sorted}
|
|
|
17 |
return clean_outputs
|
18 |
|
19 |
iface = gr.Interface(fn=lyrics_categories,
|
20 |
-
inputs=gr.inputs.Textbox(lines=
|
21 |
-
outputs=gr.outputs.Label(num_top_classes=5, label="
|
22 |
iface.launch()
|
|
|
12 |
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
13 |
predictions = predictions.detach().numpy()[0]
|
14 |
predictions = predictions * 100
|
15 |
+
index_sorted = np.argsort(predictions)[::-1]
|
16 |
clean_outputs = {label[idx]:predictions[idx] for idx in index_sorted}
|
17 |
+
print(clean_outputs)
|
18 |
return clean_outputs
|
19 |
|
20 |
iface = gr.Interface(fn=lyrics_categories,
|
21 |
+
inputs=gr.inputs.Textbox(lines=20, placeholder="Enter song lyrics here...", label="Song Lyrics"),
|
22 |
+
outputs=gr.outputs.Label(num_top_classes=5, label="Lyrics Categories"))
|
23 |
iface.launch()
|