Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +36 -0
- requirements.txt +10 -0
app.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import numpy as np
|
| 4 |
+
from sklearn.linear_model import LinearRegression
|
| 5 |
+
import plotly.express as px
|
| 6 |
+
import plotly.graph_objects as go
|
| 7 |
+
|
| 8 |
+
# Uygulama başlığı
|
| 9 |
+
st.title("TV Reklamı ve Satış Analizi")
|
| 10 |
+
|
| 11 |
+
# Veriyi yükle
|
| 12 |
+
data = pd.read_csv("https://raw.githubusercontent.com/amankharwal/Website-data/master/Advertising.csv")
|
| 13 |
+
|
| 14 |
+
# İlk 5 satırı göster
|
| 15 |
+
st.subheader("Veri Seti")
|
| 16 |
+
st.write(data.head())
|
| 17 |
+
|
| 18 |
+
# X ve y değerlerini ayır
|
| 19 |
+
x = data["TV"].values.reshape(-1, 1)
|
| 20 |
+
y = data["Sales"]
|
| 21 |
+
|
| 22 |
+
# Modeli oluştur ve eğit
|
| 23 |
+
model = LinearRegression()
|
| 24 |
+
model.fit(x, y)
|
| 25 |
+
|
| 26 |
+
# Tahminler için aralık oluştur
|
| 27 |
+
x_range = np.linspace(x.min(), x.max(), 100)
|
| 28 |
+
y_range = model.predict(x_range.reshape(-1, 1))
|
| 29 |
+
|
| 30 |
+
# Grafiği oluştur
|
| 31 |
+
fig = px.scatter(data, x='TV', y='Sales', opacity=0.65)
|
| 32 |
+
fig.add_traces(go.Scatter(x=x_range, y=y_range, name='Linear Regresyon', mode='lines'))
|
| 33 |
+
|
| 34 |
+
# Grafiği göster
|
| 35 |
+
st.subheader("TV Reklamı ve Satış İlişkisi")
|
| 36 |
+
st.plotly_chart(fig)
|
requirements.txt
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
tensorflow
|
| 3 |
+
opencv-python
|
| 4 |
+
scikit-learn
|
| 5 |
+
torch
|
| 6 |
+
torchvision
|
| 7 |
+
matplotlib
|
| 8 |
+
transformers
|
| 9 |
+
sentencepiece
|
| 10 |
+
plotly
|