Hukuna commited on
Commit
87eac36
·
verified ·
1 Parent(s): 10192bd

Update demo.py

Browse files
Files changed (1) hide show
  1. demo.py +3 -6
demo.py CHANGED
@@ -25,8 +25,6 @@ tqdm.__init__ = partialmethod(tqdm.__init__, leave=False)
25
  import streamlit as st
26
  from stmol import *
27
 
28
- def download_callback(newFileName):
29
- st.success(f"{newFileName}: successfully downloaded ")
30
  def download(outputFile,newFileName,description):
31
  with open(outputFile, "rb") as file:
32
  btn = st.download_button(
@@ -40,7 +38,7 @@ def download(outputFile,newFileName,description):
40
  import pandas as pd
41
  def display(output,style,resn):
42
  # imformation
43
- protein=Protein.from_PDB(output)
44
  st.subheader("Protein Information:")
45
  st.write(f"Device: {protein.device}")
46
  st.write(f"Protein Length: {len(protein)} residues")
@@ -49,7 +47,7 @@ def display(output,style,resn):
49
  # 显示 Protein 的序列
50
  st.subheader("Protein Sequence:")
51
  protein_sequence = protein.sequence(format="three-letter-list")
52
- st.markdown(f"**My List:** {protein_sequence}")
53
  st.write(protein_sequence)
54
  # 显示 Protein 的结构
55
  with open(output, "r") as file:
@@ -90,8 +88,7 @@ from chroma.utility.chroma import letter_to_point_cloud, plane_split_protein
90
 
91
  register_key(api_key)
92
 
93
- # device = 'cuda:2' if torch.cuda.is_available() else 'cpu'
94
- device='cuda:0'
95
  with contextlib.redirect_stdout(None):
96
  chroma = Chroma(device=device)
97
 
 
25
  import streamlit as st
26
  from stmol import *
27
 
 
 
28
  def download(outputFile,newFileName,description):
29
  with open(outputFile, "rb") as file:
30
  btn = st.download_button(
 
38
  import pandas as pd
39
  def display(output,style,resn):
40
  # imformation
41
+ protein=Protein.from_PDB(output,device=device)
42
  st.subheader("Protein Information:")
43
  st.write(f"Device: {protein.device}")
44
  st.write(f"Protein Length: {len(protein)} residues")
 
47
  # 显示 Protein 的序列
48
  st.subheader("Protein Sequence:")
49
  protein_sequence = protein.sequence(format="three-letter-list")
50
+ st.markdown(f"**Protein Sequence:** {protein_sequence}")
51
  st.write(protein_sequence)
52
  # 显示 Protein 的结构
53
  with open(output, "r") as file:
 
88
 
89
  register_key(api_key)
90
 
91
+ device = 'cuda' if torch.cuda.is_available() else 'cpu'
 
92
  with contextlib.redirect_stdout(None):
93
  chroma = Chroma(device=device)
94