first 2 functions
This commit is contained in:
42
app/app.py
Normal file
42
app/app.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# app.py
|
||||
import streamlit as st
|
||||
from tools import *
|
||||
|
||||
st.set_page_config(
|
||||
page_title="tebarius mysteryhelfer web",
|
||||
page_icon="./favicon.ico", # Alternativ: "favicon.ico" (Pfad als String)
|
||||
layout="wide"
|
||||
)
|
||||
st.logo('./logo.png', size='large')
|
||||
|
||||
# Optional: Standard für den Session State setzen
|
||||
if 'letzte_aktion' not in st.session_state:
|
||||
st.session_state['letzte_aktion'] = None
|
||||
if 'output_text' not in st.session_state:
|
||||
st.session_state['output_text'] = ''
|
||||
|
||||
st.image('./logo-mit-tb.png', width=200)
|
||||
st.title("Textverarbeitung mit Sidebar und Wiederholen-Button")
|
||||
# Eingabefeld im Hauptbereich
|
||||
input_text = st.text_area('Gib deinen Text hier ein:', height=150)
|
||||
|
||||
# --- Sidebar: Buttons selektieren und Aktion setzen ---
|
||||
st.sidebar.header("Aktionen")
|
||||
if st.sidebar.button(label='Ceasarchiffre (all)', use_container_width=True):
|
||||
st.session_state['output_text'] = cesar_all(input_text)
|
||||
st.session_state['letzte_aktion'] = 'funktion1'
|
||||
if st.sidebar.button('BW,BWW,... ermitteln', use_container_width=True):
|
||||
st.session_state['output_text'] = buchstabenwortwert(input_text)
|
||||
st.session_state['letzte_aktion'] = 'funktion2'
|
||||
|
||||
# --- Hauptbereich: Button für Wiederholung der letzten Aktion ---
|
||||
if st.button("Letzte Aktion wiederholen"):
|
||||
if st.session_state['letzte_aktion'] == 'funktion1':
|
||||
st.session_state['output_text'] = cesar_all(input_text)
|
||||
elif st.session_state['letzte_aktion'] == 'funktion2':
|
||||
st.session_state['output_text'] = buchstabenwortwert(input_text)
|
||||
|
||||
# Ausgabefeld
|
||||
st.text_area('Ausgabe:', value=st.session_state['output_text'], height=150)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user