spike_analysis / app.py
ifw-arz's picture
init
7b5e845
raw
history blame contribute delete
No virus
1.15 kB
import pandas as pd
import streamlit as st
from plot_data import plotly_plot
def main():
st.markdown("<h2 style='text-align: left; color: black; font-family:Arial;font-size:2.25rem;'>Datenanalyse</h2>", unsafe_allow_html=True)
uploaded_file = st.file_uploader("CSV hochladen", type=["csv"])
if uploaded_file is not None:
try:
df = pd.read_csv(uploaded_file)
except pd.errors.EmptyDataError:
st.error("Fehler: Leere CSV Datei")
except Exception as e:
st.error(f"Error: {str(e)}")
if uploaded_file is not None:
mittelwert = st.slider("Gleitender Mittelwert", 0, 1000, 0, 10)
time_column = st.selectbox("Zeit auswählen", df.columns, index=0)
data_column = st.selectbox("Daten auswählen", df.columns)
try:
fig = plotly_plot(df, time_column, data_column, mittelwert)
fig.update_layout(width = 1600, height = 600)
st.plotly_chart(fig)
except Exception as e:
st.error(f"Error: {str(e)}")
if __name__ == "__main__":
main()