PeterBlake01 commited on
Commit
7c282c3
1 Parent(s): 5ca3051

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -26
app.py CHANGED
@@ -1,26 +1,8 @@
1
- import pandas as pd
2
- import numpy as np
3
- from sklearn.datasets import fetch_california_housing
4
- from sklearn.model_selection import train_test_split
5
- from sklearn.ensemble import RandomForestRegressor
6
- import shap
7
- import matplotlib.pyplot as plt
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)