simonduerr commited on
Commit
980a21c
1 Parent(s): d966828

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -2,13 +2,18 @@ import gradio as gr
2
  from shutil import copyfile
3
 
4
 
 
 
 
 
 
5
  import gradio as gr
6
  import os
7
 
8
  def get_pdb(upload_choice="PDB Code", pdb_code="", filepath=""):
9
  urls = {
10
  "PDB Code": {"base":"https://files.rcsb.org/view/", "suffix":".pdb"},
11
- "AlphaFold DB": {"base":"https://alphafold.ebi.ac.uk/files/", "suffix": "-F1-model_v4.pdb"},
12
  "ESM Atlas": {"base": "https://api.esmatlas.com/fetchPredictedStructure/", "suffix":".pdb"}
13
  }
14
  if upload_choice=="local file":
@@ -126,7 +131,7 @@ with demo:
126
  gr.Markdown("# PDB viewer using Mol*")
127
  gr.Markdown("""If using please cite
128
  > David Sehnal, Sebastian Bittrich, Mandar Deshpande, Radka Svobodová, Karel Berka, Václav Bazgier, Sameer Velankar, Stephen K Burley, Jaroslav Koča, Alexander S Rose: Mol* Viewer: modern web app for 3D visualization and analysis of large biomolecular structures, Nucleic Acids Research, 2021; 10.1093/nar/gkab31.""")
129
- public_link = gr.Variable(value="https://simonduerr-molstar-gradio.hf.space")
130
  with gr.Row():
131
  with gr.Box():
132
  upload_choice = gr.Radio(["PDB Code", "AlphaFold DB", "ESM Atlas","local file"], label="File source", value='PDB Code')
@@ -144,4 +149,5 @@ with demo:
144
  gr.Examples([["PDB Code", "2CBA"],["AlphaFold DB", "A0A1U8FD60"], ["ESM Atlas", "MGYP001531319262"]], [upload_choice,inp])
145
  mol = gr.HTML()
146
  btn.click(fn=update, inputs=[upload_choice, inp, file, public_link], outputs=mol)
147
- _, _, pl = demo.launch() # use public link with share=True locally
 
 
2
  from shutil import copyfile
3
 
4
 
5
+ ## Modify to match format username-spacename
6
+ ## Only works for hosted spaces on Huggingface, for local spaces or spaces hosted on Colab you need to use the gradio.live url with share=True as described in the last two lines
7
+ public_link = "https://simonduerr-molstar-gradio.hf.space"
8
+
9
+
10
  import gradio as gr
11
  import os
12
 
13
  def get_pdb(upload_choice="PDB Code", pdb_code="", filepath=""):
14
  urls = {
15
  "PDB Code": {"base":"https://files.rcsb.org/view/", "suffix":".pdb"},
16
+ "AlphaFold DB": {"base":"https://alphafold.ebi.ac.uk/files/AF-", "suffix": "-F1-model_v4.pdb"},
17
  "ESM Atlas": {"base": "https://api.esmatlas.com/fetchPredictedStructure/", "suffix":".pdb"}
18
  }
19
  if upload_choice=="local file":
 
131
  gr.Markdown("# PDB viewer using Mol*")
132
  gr.Markdown("""If using please cite
133
  > David Sehnal, Sebastian Bittrich, Mandar Deshpande, Radka Svobodová, Karel Berka, Václav Bazgier, Sameer Velankar, Stephen K Burley, Jaroslav Koča, Alexander S Rose: Mol* Viewer: modern web app for 3D visualization and analysis of large biomolecular structures, Nucleic Acids Research, 2021; 10.1093/nar/gkab31.""")
134
+ public_link = gr.Variable(value=public_link)
135
  with gr.Row():
136
  with gr.Box():
137
  upload_choice = gr.Radio(["PDB Code", "AlphaFold DB", "ESM Atlas","local file"], label="File source", value='PDB Code')
 
149
  gr.Examples([["PDB Code", "2CBA"],["AlphaFold DB", "A0A1U8FD60"], ["ESM Atlas", "MGYP001531319262"]], [upload_choice,inp])
150
  mol = gr.HTML()
151
  btn.click(fn=update, inputs=[upload_choice, inp, file, public_link], outputs=mol)
152
+ _, _, pl = demo.launch() # use public link with share=True locally and uncomment below
153
+ #public_link = pl