Spaces:
Running
Running
Commit
•
420c089
1
Parent(s):
6a79179
Resize input box
Browse files
app.py
CHANGED
@@ -10,8 +10,8 @@ model = AutoModelForSequenceClassification.from_pretrained(repo_name)
|
|
10 |
labels = model.config.id2label
|
11 |
print(labels)
|
12 |
|
13 |
-
def predict(
|
14 |
-
inputs = tokenizer(
|
15 |
outputs = model(**inputs)
|
16 |
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
17 |
predictions = predictions.detach().numpy()[0]
|
@@ -23,5 +23,7 @@ def predict(review):
|
|
23 |
predictions[sorted_indexes[-2]], labels[sorted_indexes[-2]],
|
24 |
predictions[sorted_indexes[-3]], labels[sorted_indexes[-3]])
|
25 |
|
26 |
-
|
|
|
|
|
27 |
iface.launch()
|
10 |
labels = model.config.id2label
|
11 |
print(labels)
|
12 |
|
13 |
+
def predict(lyrics):
|
14 |
+
inputs = tokenizer(lyrics, padding=True, truncation=True, return_tensors="pt")
|
15 |
outputs = model(**inputs)
|
16 |
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
17 |
predictions = predictions.detach().numpy()[0]
|
23 |
predictions[sorted_indexes[-2]], labels[sorted_indexes[-2]],
|
24 |
predictions[sorted_indexes[-3]], labels[sorted_indexes[-3]])
|
25 |
|
26 |
+
input = gr.inputs.Textbox(lines=20)
|
27 |
+
|
28 |
+
iface = gr.Interface(fn=predict, inputs=input, outputs="text")
|
29 |
iface.launch()
|