Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,13 +19,13 @@ st.header("Analyse de Texte")
|
|
| 19 |
selected_comment = st.selectbox("Veuillez sélectionner un commentaire", comments)
|
| 20 |
|
| 21 |
# Afficher le commentaire sélectionné dans l'input text
|
| 22 |
-
text = st.
|
| 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 {}."
|
| 29 |
|
| 30 |
# Exécuter la classification seulement si du texte est entré
|
| 31 |
if text and candidate_labels:
|
|
@@ -37,10 +37,7 @@ else:
|
|
| 37 |
# Calculer les métriques de performance (vous devez ajuster ces lignes selon votre tâche)
|
| 38 |
if text and candidate_labels:
|
| 39 |
inputs = df["text"].tolist()
|
| 40 |
-
true_labels = df["label"]
|
| 41 |
-
true_labels=true_labels.replace(1,"commentaire positif")
|
| 42 |
-
true_labels=true_labels.replace(0,"commentaire negatif")
|
| 43 |
-
true_labels=true_labels.tolist()
|
| 44 |
predictions = classifier(inputs, candidate_labels, hypothesis_template=hypothesis_template)
|
| 45 |
predicted_labels = [result['labels'][0] for result in predictions]
|
| 46 |
|
|
|
|
| 19 |
selected_comment = st.selectbox("Veuillez sélectionner un commentaire", comments)
|
| 20 |
|
| 21 |
# Afficher le commentaire sélectionné dans l'input text
|
| 22 |
+
text = st.text_area('Entrer le texte à analyser', value=selected_comment)
|
| 23 |
|
| 24 |
# Labels candidats pour la classification
|
| 25 |
+
candidate_labels = [0, 1]
|
| 26 |
|
| 27 |
# Modèle de phrase pour la formation de l'hypothèse
|
| 28 |
+
hypothesis_template = "Cet exemple est un commentaire {}."
|
| 29 |
|
| 30 |
# Exécuter la classification seulement si du texte est entré
|
| 31 |
if text and candidate_labels:
|
|
|
|
| 37 |
# Calculer les métriques de performance (vous devez ajuster ces lignes selon votre tâche)
|
| 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 |
|