import streamlit as st # App title st.title("Experiment Documentation Tool") # Sidebar for navigation st.sidebar.title("Navigation") section = st.sidebar.radio("Go to", ["Introduction", "Experiment"]) if section == "Introduction": st.header("Welcome to the Experiment Documentation Tool") st.write( "This app allows you to document and save various sections of a scientific experiment such as Procedure, Apparatus, Theory, Chemical Reactions, and Conclusions." ) st.write("Select 'Experiment' from the sidebar to get started.") if section == "Experiment": st.header("Document Your Experiment") # Input fields for each section experiment_title = st.text_input("Experiment Title") procedure = st.text_area("Procedure") apparatus = st.text_area("Apparatus") theory = st.text_area("Theory") chemical_reactions = st.text_area("Chemical Reactions") conclusion = st.text_area("Conclusions") # Save inputs to a file if st.button("Save Experiment"): if experiment_title.strip(): with open(f"{experiment_title.replace(' ', '_')}.txt", "w") as f: f.write(f"Title: {experiment_title}\n\n") f.write(f"Procedure:\n{procedure}\n\n") f.write(f"Apparatus:\n{apparatus}\n\n") f.write(f"Theory:\n{theory}\n\n") f.write(f"Chemical Reactions:\n{chemical_reactions}\n\n") f.write(f"Conclusions:\n{conclusion}\n") st.success(f"Experiment '{experiment_title}' has been saved!") else: st.error("Please provide a title for the experiment.") # Display saved content for verification if st.button("Show Preview"): st.write("### Preview of the Documented Experiment:") st.write(f"**Title:** {experiment_title}") st.write(f"**Procedure:** {procedure}") st.write(f"**Apparatus:** {apparatus}") st.write(f"**Theory:** {theory}") st.write(f"**Chemical Reactions:** {chemical_reactions}") st.write(f"**Conclusions:** {conclusion}")