TillCyrill commited on
Commit
096a065
1 Parent(s): 0150901

fixed map paths

Browse files
Files changed (3) hide show
  1. Dockerfile +7 -1
  2. main.py +4 -4
  3. old_main.py +0 -30
Dockerfile CHANGED
@@ -17,6 +17,13 @@ USER root
17
  #CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
18
 
19
  # Set up a new user named "user" with user ID 1000
 
 
 
 
 
 
 
20
  RUN useradd -m -u 1000 user
21
 
22
  # Switch to the "user" user
@@ -30,7 +37,6 @@ ENV HOME=/home/user \
30
  WORKDIR $HOME/app
31
 
32
 
33
- #RUN mkdir -p /data
34
  #RUN chmod 777 /data
35
  #RUN useradd -m -u 1000 user
36
  #USER user
 
17
  #CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
18
 
19
  # Set up a new user named "user" with user ID 1000
20
+
21
+
22
+ RUN mkdir -p /maps
23
+ WORKDIR /maps
24
+ COPY maps/*pickle .
25
+
26
+
27
  RUN useradd -m -u 1000 user
28
 
29
  # Switch to the "user" user
 
37
  WORKDIR $HOME/app
38
 
39
 
 
40
  #RUN chmod 777 /data
41
  #RUN useradd -m -u 1000 user
42
  #USER user
main.py CHANGED
@@ -70,10 +70,10 @@ def convert_to_amber_format(pdbName):
70
  return pt.iterload(path+'exp.crd', top = path+'exp.top')
71
 
72
  def get_maps(mapPath):
73
- residueMap = pickle.load(open(mapPath+'atoms_residue_map_generate.pickle','rb'))
74
- nameMap = pickle.load(open(mapPath+'atoms_name_map_generate.pickle','rb'))
75
- typeMap = pickle.load(open(mapPath+'atoms_type_map_generate.pickle','rb'))
76
- elementMap = pickle.load(open(mapPath+'map_atomType_element_numbers.pickle','rb'))
77
  return residueMap, nameMap, typeMap, elementMap
78
 
79
  def get_residues_atomwise(residues):
 
70
  return pt.iterload(path+'exp.crd', top = path+'exp.top')
71
 
72
  def get_maps(mapPath):
73
+ residueMap = pickle.load(open(os.path.join(mapPath,'atoms_residue_map_generate.pickle'),'rb'))
74
+ nameMap = pickle.load(open(os.path.join(mapPath,'atoms_name_map_generate.pickle'),'rb'))
75
+ typeMap = pickle.load(open(os.path.join(mapPath,'atoms_type_map_generate.pickle'),'rb'))
76
+ elementMap = pickle.load(open(os.path.join(mapPath,'map_atomType_element_numbers.pickle'),'rb'))
77
  return residueMap, nameMap, typeMap, elementMap
78
 
79
  def get_residues_atomwise(residues):
old_main.py DELETED
@@ -1,30 +0,0 @@
1
- import gradio as gr
2
- import torch
3
- import requests
4
- from torchvision import transforms
5
-
6
- model = torch.hub.load("pytorch/vision:v0.6.0", "resnet18", pretrained=True).eval()
7
- response = requests.get("https://git.io/JJkYN")
8
- labels = response.text.split("\n")
9
-
10
-
11
- def predict(inp):
12
- inp = transforms.ToTensor()(inp).unsqueeze(0)
13
- with torch.no_grad():
14
- prediction = torch.nn.functional.softmax(model(inp)[0], dim=0)
15
- confidences = {labels[i]: float(prediction[i]) for i in range(1000)}
16
- return confidences
17
-
18
-
19
- def run():
20
- demo = gr.Interface(
21
- fn=predict,
22
- inputs=gr.inputs.Image(type="pil"),
23
- outputs=gr.outputs.Label(num_top_classes=3),
24
- )
25
-
26
- demo.launch(server_name="0.0.0.0", server_port=7860)
27
-
28
-
29
- if __name__ == "__main__":
30
- run()