Spaces:
Runtime error
Runtime error
bharat-raghunathan
commited on
Commit
•
47e00f6
1
Parent(s):
a0060b9
Update appv0.4
Browse files
app.py
CHANGED
@@ -10,10 +10,10 @@ def lyrics_categories(input_text):
|
|
10 |
inputs = tokenizer(input_text, return_tensors="pt")
|
11 |
outputs = model(**inputs)
|
12 |
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
return clean_outputs
|
18 |
|
19 |
iface = gr.Interface(fn=lyrics_categories,
|
|
|
10 |
inputs = tokenizer(input_text, return_tensors="pt")
|
11 |
outputs = model(**inputs)
|
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,
|