Spaces:
Sleeping
Sleeping
unknown
commited on
Commit
•
b87b96d
1
Parent(s):
a028de3
Add application file
Browse files
app.py
CHANGED
@@ -14,8 +14,8 @@ inf_session = rt.InferenceSession('movie-classifier.onnx')
|
|
14 |
input_name = inf_session.get_inputs()[0].name
|
15 |
output_name = inf_session.get_outputs()[0].name
|
16 |
|
17 |
-
def classify_movie_genre(
|
18 |
-
input_ids = tokenizer(
|
19 |
logits = inf_session.run([output_name], {input_name: [input_ids]})[0]
|
20 |
logits = torch.FloatTensor(logits)
|
21 |
probs = torch.sigmoid(logits)[0]
|
@@ -23,5 +23,5 @@ def classify_movie_genre(description):
|
|
23 |
|
24 |
|
25 |
label = gr.outputs.Label()
|
26 |
-
iface = gr.Interface(fn=classify_movie_genre, inputs="text", outputs=
|
27 |
iface.launch(inline=False)
|
|
|
14 |
input_name = inf_session.get_inputs()[0].name
|
15 |
output_name = inf_session.get_outputs()[0].name
|
16 |
|
17 |
+
def classify_movie_genre(Overview):
|
18 |
+
input_ids = tokenizer(Overview)['input_ids'][:512]
|
19 |
logits = inf_session.run([output_name], {input_name: [input_ids]})[0]
|
20 |
logits = torch.FloatTensor(logits)
|
21 |
probs = torch.sigmoid(logits)[0]
|
|
|
23 |
|
24 |
|
25 |
label = gr.outputs.Label()
|
26 |
+
iface = gr.Interface(fn=classify_movie_genre, inputs="text", outputs=labels)
|
27 |
iface.launch(inline=False)
|