bartmiller commited on
Commit
e3e35e7
·
verified ·
1 Parent(s): 8e22fcd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py CHANGED
@@ -1,6 +1,39 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  sentiment_pipeline = pipeline("sentiment-analysis")
5
 
6
  st.title("Sentiment Analysis with HuggingFace Spaces")
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
+ from sklearn.datasets import fetch_california_housing
5
+ from sklearn.model_selection import train_test_split
6
+ from sklearn.preprocessing import StandardScaler
7
+ from sklearn.linear_model import LinearRegression
8
+ from sklearn.metrics import mean_squared_error, r2_score
9
+
10
+ # # Load the California Housing dataset
11
+ # data = fetch_california_housing(as_frame=True)
12
+ # X = data.data
13
+ # y = data.target
14
+
15
+ # # Split the dataset into training and test sets
16
+ # X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
17
+
18
+ # # Standardize features
19
+ # scaler = StandardScaler()
20
+ # X_train = scaler.fit_transform(X_train)
21
+ # X_test = scaler.transform(X_test)
22
+
23
+ # # Train the model
24
+ # model = LinearRegression()
25
+ # model.fit(X_train, y_train)
26
+
27
+ # # Make predictions on the test set
28
+ # y_pred = model.predict(X_test)
29
+
30
+ # # Evaluate the model
31
+ # mse = mean_squared_error(y_test, y_pred)
32
+ # r2 = r2_score(y_test, y_pred)
33
+
34
+ # print(f"Mean Squared Error: {mse:.2f}")
35
+ # print(f"R-squared Score: {r2:.2f}")
36
+
37
  sentiment_pipeline = pipeline("sentiment-analysis")
38
 
39
  st.title("Sentiment Analysis with HuggingFace Spaces")