diff --git a/champion-title.xlsx b/champion-title.xlsx new file mode 100644 index 000000000000..293d8fb30221 Binary files /dev/null and b/champion-title.xlsx differ diff --git a/streamlit_app.py b/streamlit_app.py index 7a0ed1272052..b873848ba728 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,40 +1,53 @@ -import altair as alt -import numpy as np -import pandas as pd import streamlit as st - -""" -# Welcome to Streamlit! - -Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:. -If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community -forums](https://discuss.streamlit.io). - -In the meantime, below is an example of what you can do with just a few lines of code: -""" - -num_points = st.slider("Number of points in spiral", 1, 10000, 1100) -num_turns = st.slider("Number of turns in spiral", 1, 300, 31) - -indices = np.linspace(0, 1, num_points) -theta = 2 * np.pi * num_turns * indices -radius = indices - -x = radius * np.cos(theta) -y = radius * np.sin(theta) - -df = pd.DataFrame({ - "x": x, - "y": y, - "idx": indices, - "rand": np.random.randn(num_points), -}) - -st.altair_chart(alt.Chart(df, height=700, width=700) - .mark_point(filled=True) - .encode( - x=alt.X("x", axis=None), - y=alt.Y("y", axis=None), - color=alt.Color("idx", legend=None, scale=alt.Scale()), - size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])), - )) +import pandas as pd +import random + +# Laad je Excel-bestand met de vragen en antwoorden +excel_file_path = 'champion-title.xlsx' # Vervang dit met het pad naar jouw bestand +df = pd.read_excel(excel_file_path) + +# Functie om een willekeurige vraag op te halen +def get_random_question(): + random_row = df.sample(1) + question = random_row['champ-list__item__title'].values[0] + answer = random_row['champ-list__item__name'].values[0] + return question, answer + +# Streamlit-applicatie +def main(): + st.title('Vragen en Antwoorden App') + + # Overzichtspagina met knoppen + page = st.sidebar.selectbox('Selecteer een pagina:', ['Home', 'Vraag 1', 'Vraag 2', 'Vraag 3', 'Vraag 4', 'Vraag 5', 'Vraag 6']) + + if page == 'Home': + st.header('Welkom op de overzichtspagina!') + st.write('Kies een vraagcategorie uit de zijbalk.') + + # Knoppen voor verschillende vraagcategorieën + if st.sidebar.button('Vraag 1', key='1'): + st.session_state.question, st.session_state.answer = get_random_question() + st.session_state.show_answer = False + elif st.sidebar.button('Vraag 2', key='2'): + st.session_state.question, st.session_state.answer = get_random_question() + st.session_state.show_answer = False + # Voeg hier de knoppen voor Vraag 3 tot Vraag 6 toe op dezelfde manier + + elif page.startswith('Vraag'): + st.header(page) + st.write('Vraag: ' + st.session_state.question) + + # Knop om antwoord te tonen + if st.button('Toon antwoord'): + st.write('Antwoord: ' + st.session_state.answer) + st.session_state.show_answer = True + + # Knop om terug te gaan naar overzichtspagina + if st.button('Terug'): + st.session_state.sync() + st.experimental_rerun() + + st.session_state.sync() + +if __name__ == '__main__': + main()