Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0 #170

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

V0 #170

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added champion-title.xlsx
Binary file not shown.
91 changes: 52 additions & 39 deletions streamlit_app.py
Original file line number Diff line number Diff line change
@@ -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()