OzoneAsai commited on
Commit
613bec9
1 Parent(s): c638e5c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from isotopomacLib import Isotope, calculate_isotopomers, sum_mass_numbers, remove_duplicates_and_count
3
+
4
+ def main():
5
+ st.title("Isotopomer Calculator")
6
+
7
+ st.sidebar.header("Input Isotopes")
8
+ elements = get_input_elements()
9
+
10
+ isotopomers = calculate_isotopomers(elements)
11
+ st.write("Isotopomers:", isotopomers)
12
+
13
+ unique_lists_count = remove_duplicates_and_count(isotopomers)
14
+ st.write("Number of unique lists after removing duplicates:", unique_lists_count)
15
+
16
+ def get_input_elements():
17
+ elements = []
18
+ while True:
19
+ symbol = st.sidebar.text_input("Enter element symbol (e.g., H, O):")
20
+ if not symbol:
21
+ break
22
+ isotopes = st.sidebar.text_input("Enter isotopes for {} (comma-separated):".format(symbol))
23
+ isotopes = [iso.strip() for iso in isotopes.split(",")]
24
+ isotope_objects = [Isotope(symbol, int(iso)) for iso in isotopes]
25
+ elements.append(isotope_objects)
26
+ return elements
27
+
28
+ if __name__ == "__main__":
29
+ main()