AlishbaImran commited on
Commit
4f877e5
1 Parent(s): 38cd6f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -45
app.py CHANGED
@@ -15,7 +15,7 @@ from rdkit import Chem
15
  from rdkit.Chem import AllChem
16
  from sklearn.ensemble import RandomForestRegressor
17
 
18
- #For KERAS
19
  import random
20
  import numpy as np
21
  from keras.wrappers.scikit_learn import KerasRegressor
@@ -30,11 +30,6 @@ from tensorflow.keras.models import Sequential
30
  from tensorflow.keras.layers import Dense
31
  from tensorflow.keras.layers import Dropout
32
 
33
- #from keras.layers import Dense
34
- #from keras.layers import Dropout
35
- # Function to create model, required for KerasClassifier
36
-
37
-
38
  def create_model(optimizer='RMSprop', learn_rate=0.1, momentum=0.4, activation='sigmoid', dropout_rate=0.0):
39
 
40
  keras_model = Sequential()
@@ -51,28 +46,7 @@ def create_model(optimizer='RMSprop', learn_rate=0.1, momentum=0.4, activation='
51
 
52
  return keras_model
53
 
54
-
55
- ######################
56
- # Custom function
57
- ######################
58
- ## Calculate molecular descriptors
59
-
60
  def get_ecfc(smiles_list, radius=2, nBits=2048, useCounts=True):
61
- """
62
- Calculates the ECFP fingerprint for given SMILES list
63
-
64
- :param smiles_list: List of SMILES
65
- :type smiles_list: list
66
- :param radius: The ECPF fingerprints radius.
67
- :type radius: int
68
- :param nBits: The number of bits of the fingerprint vector.
69
- :type nBits: int
70
- :param useCounts: Use count vector or bit vector.
71
- :type useCounts: bool
72
- :returns: The calculated ECPF fingerprints for the given SMILES
73
- :rtype: Dataframe
74
- """
75
-
76
  ecfp_fingerprints=[]
77
  erroneous_smiles=[]
78
  for smiles in smiles_list:
@@ -98,8 +72,6 @@ def get_ecfc(smiles_list, radius=2, nBits=2048, useCounts=True):
98
 
99
 
100
 
101
-
102
- ## generate dataset it is diffrent from origin one
103
  import deepchem as dc
104
  from deepchem.models import GraphConvModel
105
 
@@ -113,20 +85,13 @@ def generate(SMILES, verbose=False):
113
  return dataset
114
 
115
 
116
- ######################
117
- # Page Title
118
- ######################
119
-
120
-
121
-
122
  st.write("""# Accelerated reaction energy prediction for redox batteries 🧪 """)
123
  st.write('By: [Alishba Imran](https://www.linkedin.com/in/alishba-imran-/)')
124
 
125
 
126
 
127
 
128
- #%%
129
- # About PART
130
 
131
  about_part = st.expander("Learn More About Project", expanded=False)
132
  with about_part:
@@ -159,20 +124,12 @@ SMILES = list(filter(None, SMILES))
159
 
160
 
161
 
162
- # st.header('Input SMILES')
163
- # SMILES[1:] # Skips the dummy first item
164
-
165
  # Use only top 1000
166
  if len(SMILES)>1000:
167
  SMILES=SMILES[0:1000]
168
 
169
- ## Calculate molecular descriptors
170
  ecfc_encoder = get_ecfc(SMILES)
171
 
172
- #Import pretrained models
173
-
174
- #---------------------------------------------------------------------------------
175
- ### generate dataset from SMILES and function generate
176
  generated_dataset = generate(SMILES)
177
 
178
  ### transformer for gcn
 
15
  from rdkit.Chem import AllChem
16
  from sklearn.ensemble import RandomForestRegressor
17
 
18
+
19
  import random
20
  import numpy as np
21
  from keras.wrappers.scikit_learn import KerasRegressor
 
30
  from tensorflow.keras.layers import Dense
31
  from tensorflow.keras.layers import Dropout
32
 
 
 
 
 
 
33
  def create_model(optimizer='RMSprop', learn_rate=0.1, momentum=0.4, activation='sigmoid', dropout_rate=0.0):
34
 
35
  keras_model = Sequential()
 
46
 
47
  return keras_model
48
 
 
 
 
 
 
 
49
  def get_ecfc(smiles_list, radius=2, nBits=2048, useCounts=True):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  ecfp_fingerprints=[]
51
  erroneous_smiles=[]
52
  for smiles in smiles_list:
 
72
 
73
 
74
 
 
 
75
  import deepchem as dc
76
  from deepchem.models import GraphConvModel
77
 
 
85
  return dataset
86
 
87
 
 
 
 
 
 
 
88
  st.write("""# Accelerated reaction energy prediction for redox batteries 🧪 """)
89
  st.write('By: [Alishba Imran](https://www.linkedin.com/in/alishba-imran-/)')
90
 
91
 
92
 
93
 
94
+
 
95
 
96
  about_part = st.expander("Learn More About Project", expanded=False)
97
  with about_part:
 
124
 
125
 
126
 
 
 
 
127
  # Use only top 1000
128
  if len(SMILES)>1000:
129
  SMILES=SMILES[0:1000]
130
 
 
131
  ecfc_encoder = get_ecfc(SMILES)
132
 
 
 
 
 
133
  generated_dataset = generate(SMILES)
134
 
135
  ### transformer for gcn