Update app.py
Browse files
app.py
CHANGED
|
@@ -183,7 +183,6 @@ def pdb_structure(Structure_index):
|
|
| 183 |
SurfacePoitCloud_all = []
|
| 184 |
for index in Structure_index:
|
| 185 |
structure_folder = join(temp_path, str(index))
|
| 186 |
-
os.makedirs(structure_folder, exist_ok=True)
|
| 187 |
created_folders.append(structure_folder)
|
| 188 |
pdb_file = join(pdb_path, f"{index}.pdb")
|
| 189 |
if os.path.exists(pdb_file):
|
|
@@ -206,17 +205,12 @@ def pdb_structure(Structure_index):
|
|
| 206 |
return SurfacePoitCloud_all_tensor
|
| 207 |
|
| 208 |
def ACE(file):
|
| 209 |
-
if not os.path.exists(pdb_path):
|
| 210 |
-
os.makedirs(pdb_path)
|
| 211 |
-
else:
|
| 212 |
-
shutil.rmtree(pdb_path)
|
| 213 |
-
os.makedirs(pdb_path)
|
| 214 |
# df = pd.read_csv(seq_path)
|
| 215 |
# test_sequences = df["Seq"].tolist()
|
| 216 |
# test_Structure_index = df["Structure_index"].tolist()
|
| 217 |
|
| 218 |
-
test_sequences =
|
| 219 |
-
test_Structure_index =
|
| 220 |
|
| 221 |
|
| 222 |
test_dict = {"text":test_sequences, 'structure':test_Structure_index}
|
|
@@ -242,7 +236,6 @@ def ACE(file):
|
|
| 242 |
print("=================================Start prediction========================")
|
| 243 |
for index, (batch, structure_fea, fingerprint) in enumerate(test_dataloader):
|
| 244 |
batchs = {k: v for k, v in batch.items()}
|
| 245 |
-
print(batchs)
|
| 246 |
outputs = model(structure_fea, batchs, fingerprint)
|
| 247 |
probability = outputs[0].tolist()
|
| 248 |
print(outputs)
|
|
@@ -265,12 +258,8 @@ def ACE(file):
|
|
| 265 |
summary['Probability'] = probability_all
|
| 266 |
summary_df = pd.DataFrame(summary)
|
| 267 |
summary_df.to_csv('output.csv', index=False)
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
out_prob = "Please download csv"
|
| 271 |
-
else:
|
| 272 |
-
out_text = output
|
| 273 |
-
out_prob = probability
|
| 274 |
return 'output.csv', out_text, out_prob
|
| 275 |
|
| 276 |
iface = gr.Interface(fn=ACE,
|
|
|
|
| 183 |
SurfacePoitCloud_all = []
|
| 184 |
for index in Structure_index:
|
| 185 |
structure_folder = join(temp_path, str(index))
|
|
|
|
| 186 |
created_folders.append(structure_folder)
|
| 187 |
pdb_file = join(pdb_path, f"{index}.pdb")
|
| 188 |
if os.path.exists(pdb_file):
|
|
|
|
| 205 |
return SurfacePoitCloud_all_tensor
|
| 206 |
|
| 207 |
def ACE(file):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
# df = pd.read_csv(seq_path)
|
| 209 |
# test_sequences = df["Seq"].tolist()
|
| 210 |
# test_Structure_index = df["Structure_index"].tolist()
|
| 211 |
|
| 212 |
+
test_sequences = file
|
| 213 |
+
test_Structure_index = "structure_1"
|
| 214 |
|
| 215 |
|
| 216 |
test_dict = {"text":test_sequences, 'structure':test_Structure_index}
|
|
|
|
| 236 |
print("=================================Start prediction========================")
|
| 237 |
for index, (batch, structure_fea, fingerprint) in enumerate(test_dataloader):
|
| 238 |
batchs = {k: v for k, v in batch.items()}
|
|
|
|
| 239 |
outputs = model(structure_fea, batchs, fingerprint)
|
| 240 |
probability = outputs[0].tolist()
|
| 241 |
print(outputs)
|
|
|
|
| 258 |
summary['Probability'] = probability_all
|
| 259 |
summary_df = pd.DataFrame(summary)
|
| 260 |
summary_df.to_csv('output.csv', index=False)
|
| 261 |
+
out_text = output
|
| 262 |
+
out_prob = probability
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
return 'output.csv', out_text, out_prob
|
| 264 |
|
| 265 |
iface = gr.Interface(fn=ACE,
|