Gina El Nesr
commited on
Commit
·
3edb1ec
1
Parent(s):
bb867b2
hf auth
Browse files
app.py
CHANGED
|
@@ -27,7 +27,6 @@ REPO_URL = "https://github.com/WaymentSteeleLab/Dyna-1.git"
|
|
| 27 |
DYNA_MODEL_ID = "gelnesr/Dyna-1"
|
| 28 |
|
| 29 |
def setup_environment():
|
| 30 |
-
"""Setup the environment by cloning the repo and downloading model weights."""
|
| 31 |
base_dir = Path(os.getcwd())
|
| 32 |
dyna1_dir = base_dir / "Dyna-1"
|
| 33 |
|
|
@@ -44,9 +43,6 @@ def setup_environment():
|
|
| 44 |
print(f"Successfully downloaded {filename}")
|
| 45 |
except Exception as e:
|
| 46 |
print(f"Error downloading {filename}: {str(e)}")
|
| 47 |
-
if not os.getenv("SPACE_ID"):
|
| 48 |
-
print("Please ensure you have access to the model weights and are logged in to HuggingFace.")
|
| 49 |
-
print("You can login using `huggingface-cli login` or by setting the HUGGING_FACE_HUB_TOKEN environment variable.")
|
| 50 |
|
| 51 |
return dyna1_dir
|
| 52 |
|
|
@@ -365,10 +361,9 @@ with dyna1_app:
|
|
| 365 |
outputs=[esm3_inputs, esm2_inputs, results_esm3, results_esm2, examples_esm3]
|
| 366 |
)
|
| 367 |
|
| 368 |
-
def predict_esm3(
|
| 369 |
if oauth_token is None:
|
| 370 |
raise gr.Error("Please log in to use this Space")
|
| 371 |
-
|
| 372 |
token_value = oauth_token.token
|
| 373 |
check_permissions(token_value)
|
| 374 |
|
|
@@ -396,7 +391,7 @@ with dyna1_app:
|
|
| 396 |
|
| 397 |
submit_btn_esm3.click(
|
| 398 |
fn=predict_esm3,
|
| 399 |
-
inputs=[
|
| 400 |
outputs=[csv_output_esm3, pdb_output_esm3]
|
| 401 |
)
|
| 402 |
|
|
|
|
| 27 |
DYNA_MODEL_ID = "gelnesr/Dyna-1"
|
| 28 |
|
| 29 |
def setup_environment():
|
|
|
|
| 30 |
base_dir = Path(os.getcwd())
|
| 31 |
dyna1_dir = base_dir / "Dyna-1"
|
| 32 |
|
|
|
|
| 43 |
print(f"Successfully downloaded {filename}")
|
| 44 |
except Exception as e:
|
| 45 |
print(f"Error downloading {filename}: {str(e)}")
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
return dyna1_dir
|
| 48 |
|
|
|
|
| 361 |
outputs=[esm3_inputs, esm2_inputs, results_esm3, results_esm2, examples_esm3]
|
| 362 |
)
|
| 363 |
|
| 364 |
+
def predict_esm3(name, sequence, pdb_id, pdb_file, chain_id, use_pdb_seq, oauth_token: gr.OAuthToken | None,=None):
|
| 365 |
if oauth_token is None:
|
| 366 |
raise gr.Error("Please log in to use this Space")
|
|
|
|
| 367 |
token_value = oauth_token.token
|
| 368 |
check_permissions(token_value)
|
| 369 |
|
|
|
|
| 391 |
|
| 392 |
submit_btn_esm3.click(
|
| 393 |
fn=predict_esm3,
|
| 394 |
+
inputs=[name_input, sequence_input_esm3, pdb_id, pdb_file, chain_id, use_pdb_seq],
|
| 395 |
outputs=[csv_output_esm3, pdb_output_esm3]
|
| 396 |
)
|
| 397 |
|