Update app.py
Browse files
app.py
CHANGED
@@ -65,7 +65,7 @@ def CTXGen(Ο, g_num, length_range, model_name):
|
|
65 |
while count < gen_num:
|
66 |
new_seq = None
|
67 |
if is_stopped:
|
68 |
-
return pd.DataFrame()
|
69 |
|
70 |
if time.time() - start_time > 1200:
|
71 |
break
|
@@ -83,7 +83,7 @@ def CTXGen(Ο, g_num, length_range, model_name):
|
|
83 |
|
84 |
for i in range(length):
|
85 |
if is_stopped:
|
86 |
-
return pd.DataFrame()
|
87 |
|
88 |
_, idx_seq, idx_msa, attn_idx = get_paded_token_idx_gen(vocab_mlm, seq, new_seq)
|
89 |
idx_seq = torch.tensor(idx_seq).unsqueeze(0).to(device)
|
@@ -143,10 +143,14 @@ def CTXGen(Ο, g_num, length_range, model_name):
|
|
143 |
})
|
144 |
out.to_csv("output.csv", index=False, encoding='utf-8-sig')
|
145 |
count += 1
|
146 |
-
yield
|
147 |
-
return
|
148 |
|
149 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
150 |
gr.Markdown("# Conotoxin Unconstrained Generation")
|
151 |
gr.Markdown("#### Input")
|
152 |
gr.Markdown("β
**Ο**: temperature factor controls the diversity of conotoxins generated. The higher the value, the higher the diversity")
|
@@ -161,12 +165,12 @@ with gr.Blocks() as demo:
|
|
161 |
with gr.Row():
|
162 |
start_button = gr.Button("Start Generation")
|
163 |
stop_button = gr.Button("Stop Generation")
|
164 |
-
with gr.Row():
|
165 |
-
output_df = gr.DataFrame(label="Generated Conotoxins")
|
166 |
with gr.Row():
|
167 |
output_file = gr.File(label="Download generated conotoxins")
|
168 |
-
|
169 |
-
|
|
|
|
|
170 |
stop_button.click(stop_generation, outputs=None)
|
171 |
|
172 |
demo.launch()
|
|
|
65 |
while count < gen_num:
|
66 |
new_seq = None
|
67 |
if is_stopped:
|
68 |
+
return "output.csv", pd.DataFrame()
|
69 |
|
70 |
if time.time() - start_time > 1200:
|
71 |
break
|
|
|
83 |
|
84 |
for i in range(length):
|
85 |
if is_stopped:
|
86 |
+
return "output.csv", pd.DataFrame()
|
87 |
|
88 |
_, idx_seq, idx_msa, attn_idx = get_paded_token_idx_gen(vocab_mlm, seq, new_seq)
|
89 |
idx_seq = torch.tensor(idx_seq).unsqueeze(0).to(device)
|
|
|
143 |
})
|
144 |
out.to_csv("output.csv", index=False, encoding='utf-8-sig')
|
145 |
count += 1
|
146 |
+
yield "output.csv", out
|
147 |
+
return "output.csv", out
|
148 |
|
149 |
with gr.Blocks() as demo:
|
150 |
+
gr.Markdown("π **[Label Prediction](https://huggingface.co/spaces/oucgc1996/CTXGen_Label_Prediction)**")
|
151 |
+
gr.Markdown("π **[Unconstrained Generation](https://huggingface.co/spaces/oucgc1996/CTXGen_Unconstrained_generation)**")
|
152 |
+
gr.Markdown("π **[Conditional Generation](https://huggingface.co/spaces/oucgc1996/CTXGen_conditional_generation)**")
|
153 |
+
gr.Markdown("π **[Optimization Generation](https://huggingface.co/spaces/oucgc1996/CTXGen_optimization_generation)**")
|
154 |
gr.Markdown("# Conotoxin Unconstrained Generation")
|
155 |
gr.Markdown("#### Input")
|
156 |
gr.Markdown("β
**Ο**: temperature factor controls the diversity of conotoxins generated. The higher the value, the higher the diversity")
|
|
|
165 |
with gr.Row():
|
166 |
start_button = gr.Button("Start Generation")
|
167 |
stop_button = gr.Button("Stop Generation")
|
|
|
|
|
168 |
with gr.Row():
|
169 |
output_file = gr.File(label="Download generated conotoxins")
|
170 |
+
with gr.Row():
|
171 |
+
output_df = gr.DataFrame(label="Generated Conotoxins")
|
172 |
+
|
173 |
+
start_button.click(CTXGen, inputs=[Ο, g_num, length_range, model_name], outputs=[output_file, output_df])
|
174 |
stop_button.click(stop_generation, outputs=None)
|
175 |
|
176 |
demo.launch()
|