Spaces:
Sleeping
Sleeping
wwydmanski
commited on
Commit
•
df06262
1
Parent(s):
3f2e816
Update app.py
Browse files
app.py
CHANGED
@@ -41,30 +41,28 @@ def fold_prot_locally(sequence):
|
|
41 |
sample_code = """
|
42 |
## Sample usage
|
43 |
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
-
client = Client("https://wwydmanski-esmfold.hf.space/")
|
48 |
-
|
49 |
-
def fold_huggingface(sequence, fname=None):
|
50 |
-
result = client.predict(
|
51 |
-
sequence, # str in 'sequence' Textbox component
|
52 |
-
api_name="/predict")
|
53 |
-
result = eval(result)[0]
|
54 |
-
if fname is None:
|
55 |
-
with tempfile.NamedTemporaryFile("w", delete=False, suffix=".pdb", prefix="esmfold_") as fp:
|
56 |
-
fp.write(result)
|
57 |
-
fp.flush()
|
58 |
-
return fp.name
|
59 |
-
else:
|
60 |
-
with open(fname, "w") as fp:
|
61 |
-
fp.write(result)
|
62 |
-
fp.flush()
|
63 |
-
return fname
|
64 |
-
|
65 |
-
pdb_fname = fold_huggingface("MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN")
|
66 |
-
|
67 |
-
```
|
68 |
"""
|
69 |
|
70 |
tokenizer = AutoTokenizer.from_pretrained("facebook/esmfold_v1")
|
|
|
41 |
sample_code = """
|
42 |
## Sample usage
|
43 |
|
44 |
+
from gradio_client import Client
|
45 |
+
|
46 |
+
client = Client("https://wwydmanski-esmfold.hf.space/")
|
47 |
+
|
48 |
+
def fold_huggingface(sequence, fname=None):
|
49 |
+
result = client.predict(
|
50 |
+
sequence, # str in 'sequence' Textbox component
|
51 |
+
api_name="/predict")
|
52 |
+
result = eval(result)[0]
|
53 |
+
if fname is None:
|
54 |
+
with tempfile.NamedTemporaryFile("w", delete=False, suffix=".pdb", prefix="esmfold_") as fp:
|
55 |
+
fp.write(result)
|
56 |
+
fp.flush()
|
57 |
+
return fp.name
|
58 |
+
else:
|
59 |
+
with open(fname, "w") as fp:
|
60 |
+
fp.write(result)
|
61 |
+
fp.flush()
|
62 |
+
return fname
|
63 |
+
|
64 |
+
pdb_fname = fold_huggingface("MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN")
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
"""
|
67 |
|
68 |
tokenizer = AutoTokenizer.from_pretrained("facebook/esmfold_v1")
|