Update app.py
Browse files
app.py
CHANGED
@@ -52,7 +52,7 @@ def CTXGen(τ, g_num, length_range, progress=gr.Progress()):
|
|
52 |
|
53 |
start_time = time.time()
|
54 |
while count < gen_num:
|
55 |
-
if time.time() - start_time >
|
56 |
break
|
57 |
gen_len = random.randint(int(start), int(end))
|
58 |
X3 = "X" * gen_len
|
@@ -114,8 +114,8 @@ def CTXGen(τ, g_num, length_range, progress=gr.Progress()):
|
|
114 |
out = pd.DataFrame({'Generated_seq': generated_seqs_FINAL, 'Subtype': cls_pos_all, 'Subtype_probability': cls_probability_all, 'Potency': act_pos_all, 'Potency_probability': act_probability_all, 'random_seed': seed})
|
115 |
out.to_csv("output.csv", index=False, encoding='utf-8-sig')
|
116 |
count += 1
|
117 |
-
progress(count / gen_num, desc="Generating
|
118 |
-
return 'output.csv', f"Generated {count}
|
119 |
|
120 |
iface = gr.Interface(
|
121 |
fn=CTXGen,
|
@@ -125,7 +125,7 @@ iface = gr.Interface(
|
|
125 |
RangeSlider(minimum=8, maximum=50, step=1, value=(12, 17), label="Length range")
|
126 |
],
|
127 |
outputs=[
|
128 |
-
gr.File(label="Download generated
|
129 |
gr.Textbox(label="Progress")
|
130 |
]
|
131 |
)
|
|
|
52 |
|
53 |
start_time = time.time()
|
54 |
while count < gen_num:
|
55 |
+
if time.time() - start_time > 1200:
|
56 |
break
|
57 |
gen_len = random.randint(int(start), int(end))
|
58 |
X3 = "X" * gen_len
|
|
|
114 |
out = pd.DataFrame({'Generated_seq': generated_seqs_FINAL, 'Subtype': cls_pos_all, 'Subtype_probability': cls_probability_all, 'Potency': act_pos_all, 'Potency_probability': act_probability_all, 'random_seed': seed})
|
115 |
out.to_csv("output.csv", index=False, encoding='utf-8-sig')
|
116 |
count += 1
|
117 |
+
progress(count / gen_num, desc="Generating conotoxins...")
|
118 |
+
return 'output.csv', f"Generated {count} conotoxins."
|
119 |
|
120 |
iface = gr.Interface(
|
121 |
fn=CTXGen,
|
|
|
125 |
RangeSlider(minimum=8, maximum=50, step=1, value=(12, 17), label="Length range")
|
126 |
],
|
127 |
outputs=[
|
128 |
+
gr.File(label="Download generated conotoxins"),
|
129 |
gr.Textbox(label="Progress")
|
130 |
]
|
131 |
)
|