Simon Duerr commited on
Commit
9d0e9cd
1 Parent(s): a82b6a2

update url

Browse files
Files changed (1) hide show
  1. rosettafold_pymol.py +9 -4
rosettafold_pymol.py CHANGED
@@ -2,6 +2,7 @@ from pymol import cmd
2
  import requests
3
 
4
  import os
 
5
 
6
  # from gradio_client import Client
7
 
@@ -133,10 +134,14 @@ def query_rosettafold2(
133
  num_models:
134
  Number of models Default:0
135
  """
136
- if os.path.exists("/home/user/app/"):
137
- url = "https://simonduerr-rosettafold2.hf.space"
138
- else:
 
 
139
  url = "http://localhost:7860"
 
 
140
 
141
  response = requests.post(
142
  url + "/run/rosettafold2/",
@@ -162,7 +167,7 @@ def query_rosettafold2(
162
  try:
163
  data = response["data"]
164
  except KeyError:
165
- print(response["error"])
166
  return None
167
  with open(f"{jobname}.pdb", "w") as out:
168
  out.writelines(data)
 
2
  import requests
3
 
4
  import os
5
+ import time
6
 
7
  # from gradio_client import Client
8
 
 
134
  num_models:
135
  Number of models Default:0
136
  """
137
+
138
+ # check if server is running on localhost
139
+
140
+ try:
141
+ requests.get("http://localhost:7860")
142
  url = "http://localhost:7860"
143
+ except requests.exceptions.ConnectionError:
144
+ url = "https://simonduerr-rosettafold2.hf.space"
145
 
146
  response = requests.post(
147
  url + "/run/rosettafold2/",
 
167
  try:
168
  data = response["data"]
169
  except KeyError:
170
+ # print(response["error"])
171
  return None
172
  with open(f"{jobname}.pdb", "w") as out:
173
  out.writelines(data)