simonduerr commited on
Commit
60aadf0
·
1 Parent(s): 5c6b96b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
-
3
 
4
 
5
  import gradio as gr
@@ -8,7 +8,9 @@ import os
8
  def get_pdb(pdb_code="", filepath=""):
9
  if pdb_code is None or pdb_code == "":
10
  try:
11
- return filepath.name
 
 
12
  except AttributeError as e:
13
  return None
14
  else:
@@ -94,7 +96,7 @@ def molecule(input_pdb, public_link):
94
 
95
  </html>"""
96
 
97
- return f"""<iframe style="width: 100%; height: 600px" name="result" allow="midi; geolocation; microphone; camera;
98
  display-capture; encrypted-media;" sandbox="allow-modals allow-forms
99
  allow-scripts allow-same-origin allow-popups
100
  allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
@@ -103,7 +105,6 @@ def molecule(input_pdb, public_link):
103
 
104
  def update(inp, file, public_link):
105
  pdb_path = get_pdb(inp, file)
106
- print("public link", public_link)
107
  return molecule(pdb_path, public_link)
108
 
109
 
 
1
  import gradio as gr
2
+ from shutil import copyfile
3
 
4
 
5
  import gradio as gr
 
8
  def get_pdb(pdb_code="", filepath=""):
9
  if pdb_code is None or pdb_code == "":
10
  try:
11
+ #move file to home folder to have it accessible from the web
12
+ copyfile(filepath.name, os.path.join(os.getcwd(), os.path.basename(filepath.name))
13
+ return os.path.join(os.getcwd(), os.path.basename(filepath.name)
14
  except AttributeError as e:
15
  return None
16
  else:
 
96
 
97
  </html>"""
98
 
99
+ return f"""<iframe style="width: 100%; height: 720px" name="result" allow="midi; geolocation; microphone; camera;
100
  display-capture; encrypted-media;" sandbox="allow-modals allow-forms
101
  allow-scripts allow-same-origin allow-popups
102
  allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
 
105
 
106
  def update(inp, file, public_link):
107
  pdb_path = get_pdb(inp, file)
 
108
  return molecule(pdb_path, public_link)
109
 
110