Spaces:
No application file
No application file
Create App.py
Browse files
App.py
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import graphviz
|
3 |
+
|
4 |
+
def generate_flowchart(process_text):
|
5 |
+
dot = graphviz.Digraph()
|
6 |
+
|
7 |
+
# Split lines and create nodes
|
8 |
+
steps = process_text.strip().split("\n")
|
9 |
+
|
10 |
+
for i, step in enumerate(steps):
|
11 |
+
node_label = step.strip()
|
12 |
+
dot.node(str(i), node_label) # Create a node
|
13 |
+
|
14 |
+
if i > 0:
|
15 |
+
dot.edge(str(i - 1), str(i)) # Connect previous step
|
16 |
+
|
17 |
+
return dot
|
18 |
+
|
19 |
+
def main():
|
20 |
+
st.title("Process Flow Diagram Creator")
|
21 |
+
|
22 |
+
st.write("Enter your process steps (one step per line) below:")
|
23 |
+
|
24 |
+
# Text input area
|
25 |
+
process_text = st.text_area("Process Steps", height=200)
|
26 |
+
|
27 |
+
if st.button("Generate Flowchart"):
|
28 |
+
if process_text.strip():
|
29 |
+
flowchart = generate_flowchart(process_text)
|
30 |
+
st.graphviz_chart(flowchart)
|
31 |
+
else:
|
32 |
+
st.warning("Please enter process steps.")
|
33 |
+
|
34 |
+
# File uploader for .txt files
|
35 |
+
uploaded_file = st.file_uploader("Or upload a .txt file", type=["txt"])
|
36 |
+
|
37 |
+
if uploaded_file is not None:
|
38 |
+
process_text = uploaded_file.read().decode("utf-8")
|
39 |
+
flowchart = generate_flowchart(process_text)
|
40 |
+
st.graphviz_chart(flowchart)
|
41 |
+
|
42 |
+
if __name__ == "__main__":
|
43 |
+
main()
|
44 |
+
import streamlit as st
|
45 |
+
import graphviz
|
46 |
+
|
47 |
+
def generate_flowchart(process_text):
|
48 |
+
dot = graphviz.Digraph()
|
49 |
+
|
50 |
+
# Split lines and create nodes
|
51 |
+
steps = process_text.strip().split("\n")
|
52 |
+
|
53 |
+
for i, step in enumerate(steps):
|
54 |
+
node_label = step.strip()
|
55 |
+
dot.node(str(i), node_label) # Create a node
|
56 |
+
|
57 |
+
if i > 0:
|
58 |
+
dot.edge(str(i - 1), str(i)) # Connect previous step
|
59 |
+
|
60 |
+
return dot
|
61 |
+
|
62 |
+
def main():
|
63 |
+
st.title("Process Flow Diagram Creator")
|
64 |
+
|
65 |
+
st.write("Enter your process steps (one step per line) below:")
|
66 |
+
|
67 |
+
# Text input area
|
68 |
+
process_text = st.text_area("Process Steps", height=200)
|
69 |
+
|
70 |
+
if st.button("Generate Flowchart"):
|
71 |
+
if process_text.strip():
|
72 |
+
flowchart = generate_flowchart(process_text)
|
73 |
+
st.graphviz_chart(flowchart)
|
74 |
+
else:
|
75 |
+
st.warning("Please enter process steps.")
|
76 |
+
|
77 |
+
# File uploader for .txt files
|
78 |
+
uploaded_file = st.file_uploader("Or upload a .txt file", type=["txt"])
|
79 |
+
|
80 |
+
if uploaded_file is not None:
|
81 |
+
process_text = uploaded_file.read().decode("utf-8")
|
82 |
+
flowchart = generate_flowchart(process_text)
|
83 |
+
st.graphviz_chart(flowchart)
|
84 |
+
|
85 |
+
if __name__ == "__main__":
|
86 |
+
main()
|
87 |
+
|