import streamlit as st import graphviz def generate_flowchart(process_text): dot = graphviz.Digraph() # Split lines and create nodes steps = process_text.strip().split("\n") for i, step in enumerate(steps): node_label = step.strip() dot.node(str(i), node_label) # Create a node if i > 0: dot.edge(str(i - 1), str(i)) # Connect previous step return dot def main(): st.title("Process Flow Diagram Creator") st.write("Enter your process steps (one step per line) below:") # Text input area process_text = st.text_area("Process Steps", height=200) if st.button("Generate Flowchart"): if process_text.strip(): flowchart = generate_flowchart(process_text) st.graphviz_chart(flowchart) else: st.warning("Please enter process steps.") # File uploader for .txt files uploaded_file = st.file_uploader("Or upload a .txt file", type=["txt"]) if uploaded_file is not None: process_text = uploaded_file.read().decode("utf-8") flowchart = generate_flowchart(process_text) st.graphviz_chart(flowchart) if __name__ == "__main__": main() import streamlit as st import graphviz def generate_flowchart(process_text): dot = graphviz.Digraph() # Split lines and create nodes steps = process_text.strip().split("\n") for i, step in enumerate(steps): node_label = step.strip() dot.node(str(i), node_label) # Create a node if i > 0: dot.edge(str(i - 1), str(i)) # Connect previous step return dot def main(): st.title("Process Flow Diagram Creator") st.write("Enter your process steps (one step per line) below:") # Text input area process_text = st.text_area("Process Steps", height=200) if st.button("Generate Flowchart"): if process_text.strip(): flowchart = generate_flowchart(process_text) st.graphviz_chart(flowchart) else: st.warning("Please enter process steps.") # File uploader for .txt files uploaded_file = st.file_uploader("Or upload a .txt file", type=["txt"]) if uploaded_file is not None: process_text = uploaded_file.read().decode("utf-8") flowchart = generate_flowchart(process_text) st.graphviz_chart(flowchart) if __name__ == "__main__": main()