as-cle-bert commited on
Commit
378df9a
1 Parent(s): 5743690

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -15
app.py CHANGED
@@ -148,8 +148,22 @@ def load_protein_sequences(fasta_file):
148
  protein_sequences[record.id] = str(record.seq)
149
  return protein_sequences
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  iface = gr.Interface(
152
- title="Proteinviz",
153
  fn=fold_protein,
154
  inputs=gr.Textbox(
155
  label="Protein Sequence",
@@ -165,20 +179,14 @@ iface = gr.Interface(
165
  ]
166
  )
167
 
168
- with gr.Blocks() as demo1:
169
- input_seqs = gr.File(label="FASTA File With Protein Sequences")
170
- @gr.render(inputs=input_seqs, concurrency_limit=100)
171
- def show_split(inputfile):
172
- if inputfile is None:
173
- gr.Markdown("## No Input Provided")
174
- else:
175
- seqs = load_protein_sequences(inputfile)
176
- print("Loaded sequences")
177
- for seq in seqs:
178
- pdb_path = f'{seq.replace(" ", "_").replace(",","")}.pdb'
179
- html = fold_protein_wpdb(seqs[seq], pdb_path)
180
- print(f"Prediction for {seq} is over")
181
- gr.HTML(html, label=f"{seq} structural representation")
182
 
183
 
184
  demo = gr.TabbedInterface([iface, demo1], ["Single Protein Structure Prediction", "Bulk Protein Structure Prediction"])
 
148
  protein_sequences[record.id] = str(record.seq)
149
  return protein_sequences
150
 
151
+ def show_split(inputfile):
152
+ seqs = load_protein_sequences(inputfile)
153
+ htmls = []
154
+ for seq in seqs:
155
+ pdb_path = f'{seq.replace(" ", "_").replace(",","")}.pdb'
156
+ html = fold_protein_wpdb(seqs[seq], pdb_path)
157
+ x = f"""<h3>>{seq}</h3>
158
+ <br>
159
+ """
160
+ htmls.append(x+html)
161
+ final = "\n<br>\n".join(htmls)
162
+ realhtml = "<div>\n"+final+"\n</div>"
163
+ return realhtml
164
+
165
  iface = gr.Interface(
166
+ title="SingleProteinviz",
167
  fn=fold_protein,
168
  inputs=gr.Textbox(
169
  label="Protein Sequence",
 
179
  ]
180
  )
181
 
182
+ demo1 = gr.Interface(
183
+ title="BulkProteinviz",
184
+ fn=show_split,
185
+ inputs=gr.File(
186
+ label="FASTA File With Protein Sequences",
187
+ ),
188
+ outputs= gr.HTML(label="Protein 3D models")
189
+ )
 
 
 
 
 
 
190
 
191
 
192
  demo = gr.TabbedInterface([iface, demo1], ["Single Protein Structure Prediction", "Bulk Protein Structure Prediction"])