Update app.py
Browse files
app.py
CHANGED
@@ -2,20 +2,14 @@ import pandas as pd
|
|
2 |
import plotly.express as px
|
3 |
import streamlit as st
|
4 |
from transformers import pipeline
|
5 |
-
import base64
|
6 |
|
7 |
-
# Function to add custom background image
|
8 |
-
def add_bg_from_url(
|
9 |
-
# Convert image to base64
|
10 |
-
with open(image_path, "rb") as image_file:
|
11 |
-
encoded_string = base64.b64encode(image_file.read()).decode()
|
12 |
-
|
13 |
-
# HTML for background image
|
14 |
st.markdown(
|
15 |
f"""
|
16 |
<style>
|
17 |
.stApp {{
|
18 |
-
background-image: url("
|
19 |
background-size: cover;
|
20 |
background-position: center center;
|
21 |
background-repeat: no-repeat;
|
@@ -25,17 +19,8 @@ def add_bg_from_url(image_path):
|
|
25 |
unsafe_allow_html=True
|
26 |
)
|
27 |
|
28 |
-
# Add background image (replace with your image path)
|
29 |
-
add_bg_from_url('path_to_your_image.jpg') # Replace with your image path
|
30 |
-
|
31 |
-
# Title and header styling
|
32 |
-
st.markdown("""
|
33 |
-
<h1 style="color: #00f7b7; font-family: 'Arial', sans-serif; text-align: center;">Smart Expense Tracker</h1>
|
34 |
-
""", unsafe_allow_html=True)
|
35 |
-
|
36 |
# File upload
|
37 |
uploaded_file = st.file_uploader("Upload your expense CSV file", type=["csv"])
|
38 |
-
|
39 |
if uploaded_file:
|
40 |
df = pd.read_csv(uploaded_file)
|
41 |
|
@@ -106,3 +91,7 @@ if uploaded_file:
|
|
106 |
|
107 |
fig3 = monthly_expenses_df.plot(kind='bar', figsize=(10, 6))
|
108 |
st.pyplot(fig3)
|
|
|
|
|
|
|
|
|
|
2 |
import plotly.express as px
|
3 |
import streamlit as st
|
4 |
from transformers import pipeline
|
|
|
5 |
|
6 |
+
# Function to add custom background image from a URL
|
7 |
+
def add_bg_from_url(image_url):
|
|
|
|
|
|
|
|
|
|
|
8 |
st.markdown(
|
9 |
f"""
|
10 |
<style>
|
11 |
.stApp {{
|
12 |
+
background-image: url("{image_url}");
|
13 |
background-size: cover;
|
14 |
background-position: center center;
|
15 |
background-repeat: no-repeat;
|
|
|
19 |
unsafe_allow_html=True
|
20 |
)
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
# File upload
|
23 |
uploaded_file = st.file_uploader("Upload your expense CSV file", type=["csv"])
|
|
|
24 |
if uploaded_file:
|
25 |
df = pd.read_csv(uploaded_file)
|
26 |
|
|
|
91 |
|
92 |
fig3 = monthly_expenses_df.plot(kind='bar', figsize=(10, 6))
|
93 |
st.pyplot(fig3)
|
94 |
+
|
95 |
+
# Add the background image using the provided URL
|
96 |
+
background_image_url = 'https://huggingface.co/spaces/engralimalik/Smart-Expense-Tracker/resolve/main/colorful-abstract-textured-background-design.jpg'
|
97 |
+
add_bg_from_url(background_image_url)
|