Update app.py
Browse files
app.py
CHANGED
@@ -5,10 +5,15 @@ from transformers import pipeline
|
|
5 |
classifier3 = pipeline('text-classification', model='nlmaldonadog/clasificador-rotten-tomatoes-bert-base-uncased')
|
6 |
classifier4 = pipeline('text-classification', model='nlmaldonadog/clasificador-rotten-tomatoes-xlnet-base-cased')
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
def predict(text):
|
9 |
-
|
10 |
-
|
11 |
-
return
|
12 |
|
13 |
ifg = gr.Interface(fn=predict, inputs=[gr.Textbox(placeholder='Escribe aquí...')], outputs="text")
|
14 |
ifg.launch(share=True)
|
|
|
5 |
classifier3 = pipeline('text-classification', model='nlmaldonadog/clasificador-rotten-tomatoes-bert-base-uncased')
|
6 |
classifier4 = pipeline('text-classification', model='nlmaldonadog/clasificador-rotten-tomatoes-xlnet-base-cased')
|
7 |
|
8 |
+
def val_label(lab):
|
9 |
+
if lab == "LABEL_1":
|
10 |
+
return "Positive"
|
11 |
+
return "Negative"
|
12 |
+
|
13 |
def predict(text):
|
14 |
+
m3 = classifier3(text)[0]
|
15 |
+
prediction = f"Model 3: {val_label(m3['label'])} with {m3['score']} of confidence.\nModel 4: {val_label(m4['label']} with {m4['score']} of confidence."
|
16 |
+
return prediction
|
17 |
|
18 |
ifg = gr.Interface(fn=predict, inputs=[gr.Textbox(placeholder='Escribe aquí...')], outputs="text")
|
19 |
ifg.launch(share=True)
|