Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ selected_comment = st.selectbox("Veuillez sélectionner un commentaire", comment
|
|
22 |
text = st.text_input('Entrer le texte à analyser', value=selected_comment)
|
23 |
|
24 |
# Labels candidats pour la classification
|
25 |
-
candidate_labels = [
|
26 |
|
27 |
# Modèle de phrase pour la formation de l'hypothèse
|
28 |
hypothesis_template = "Cet exemple est un {}."
|
@@ -38,6 +38,8 @@ else:
|
|
38 |
if text and candidate_labels:
|
39 |
inputs = df["text"].tolist()
|
40 |
true_labels = df["label"].tolist()
|
|
|
|
|
41 |
predictions = classifier(inputs, candidate_labels, hypothesis_template=hypothesis_template)
|
42 |
predicted_labels = [result['labels'][0] for result in predictions]
|
43 |
|
|
|
22 |
text = st.text_input('Entrer le texte à analyser', value=selected_comment)
|
23 |
|
24 |
# Labels candidats pour la classification
|
25 |
+
candidate_labels = ["commentaire positif", "commentaire negatif"]
|
26 |
|
27 |
# Modèle de phrase pour la formation de l'hypothèse
|
28 |
hypothesis_template = "Cet exemple est un {}."
|
|
|
38 |
if text and candidate_labels:
|
39 |
inputs = df["text"].tolist()
|
40 |
true_labels = df["label"].tolist()
|
41 |
+
true_labels=true_labels.replace(1,"commentaire positif")
|
42 |
+
true_labels=true_labels.replace(0,"commentaire negatif")
|
43 |
predictions = classifier(inputs, candidate_labels, hypothesis_template=hypothesis_template)
|
44 |
predicted_labels = [result['labels'][0] for result in predictions]
|
45 |
|