Spaces:
Runtime error
Runtime error
PeterBlake01
commited on
Commit
•
7c282c3
1
Parent(s):
5ca3051
Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,8 @@
|
|
1 |
-
import
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
# Chargement et préparation des données California Housing
|
10 |
-
california = fetch_california_housing()
|
11 |
-
X = pd.DataFrame(california.data, columns=california.feature_names)
|
12 |
-
y = california.target # renommage pour clarté
|
13 |
-
|
14 |
-
# Division des données en ensembles d'entraînement et de test
|
15 |
-
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
|
16 |
-
|
17 |
-
# Construction et entraînement du modèle
|
18 |
-
model = RandomForestRegressor(random_state=42)
|
19 |
-
model.fit(X_train, y_train)
|
20 |
-
|
21 |
-
# Création de l'expliqueur SHAP et calcul des valeurs SHAP
|
22 |
-
explainer = shap.TreeExplainer(model)
|
23 |
-
shap_values = explainer.shap_values(X_test)
|
24 |
-
|
25 |
-
# Visualisation des valeurs SHAP
|
26 |
-
shap.summary_plot(shap_values, X_test)
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
pipe =pipeline('Sentiment analysis')
|
5 |
+
text = st.text_area("entrer un text")
|
6 |
+
if text:
|
7 |
+
out = pipe(text)
|
8 |
+
st.json(out)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|