Py.Cafe

OMGToFo/

streamlit-pycafe-interactive-app

Interactive App with Streamlit on Py.cafe

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import streamlit as st
import numpy as np
import pandas as pd


print("\x1b[1;92mStreamlit script running...\x1b[0m")

st.title("Probetest of pycafe")






#st.subheader("DataFrame sample")
df = pd.DataFrame(np.random.randn(50, 20), columns=("col %d" % i for i in range(20)))
#st.dataframe(df)  # Same as st.write(df)


st.subheader("Camera and image")
if st.toggle("Show camera"):
    picture = st.camera_input("Take a picture")

    if picture:
        st.image(picture)

st.markdown(
    """
### Useful links:
            
### Community

 * [Py.cafe Discord](https://discord.gg/RpwWnFV3Dv)
 * [Streamlit community forum](https://discuss.streamlit.io/)
"""
)

import streamlit as st

import pySBB

stationCol1, stationCol2 = st.columns(2)
with stationCol1:
	startStation = st.text_input("Start")
with stationCol2:
    zielStation = st.text_input("Ziel")

if startStation !="" and zielStation =="":
    st.write("Alle Abfahrten ab " + startStation)
    entries = pySBB.get_stationboard(startStation)
    for e in entries:
        st.info(e)
    

import json

if startStation !="":
    if st.sidebar.button("Zeige json stationboard"):
        entry = pySBB.get_stationboard(startStation, limit=1)[0]
        st.write(json.dumps(entry._data, indent=1))
        

if startStation !="" and zielStation !="":
    connections = pySBB.get_connections(startStation, zielStation)
    for c in connections:
        st.info(c)