jfaustin commited on
Commit
24b25ab
·
1 Parent(s): 5b50998

wip: viz cif

Browse files
Files changed (5) hide show
  1. Dockerfile +8 -0
  2. Makefile +3 -1
  3. app.py +1 -1
  4. molecule.py +7 -6
  5. pred.cif +0 -0
Dockerfile CHANGED
@@ -26,6 +26,7 @@ RUN cd /app/folding-studio && uv pip install -e .
26
 
27
  COPY app.py /app/app.py
28
  COPY molecule.py /app/molecule.py
 
29
 
30
  EXPOSE 7860
31
  ENV GRADIO_SERVER_NAME="0.0.0.0"
@@ -33,4 +34,11 @@ ARG FOLDING_API_KEY
33
  ARG FOLDING_PROJECT_CODE
34
  ENV FOLDING_API_KEY=$FOLDING_API_KEY
35
  ENV FOLDING_PROJECT_CODE=$FOLDING_PROJECT_CODE
 
 
 
 
 
 
 
36
  CMD ["python3", "app.py"]
 
26
 
27
  COPY app.py /app/app.py
28
  COPY molecule.py /app/molecule.py
29
+ COPY pred.cif /app/boltz_results/pred_model_0.cif
30
 
31
  EXPOSE 7860
32
  ENV GRADIO_SERVER_NAME="0.0.0.0"
 
34
  ARG FOLDING_PROJECT_CODE
35
  ENV FOLDING_API_KEY=$FOLDING_API_KEY
36
  ENV FOLDING_PROJECT_CODE=$FOLDING_PROJECT_CODE
37
+
38
+ # Create directory for HTML output
39
+ RUN mkdir -p /app/output/html
40
+
41
+ # Create volume for HTML output
42
+ VOLUME ["/app/output/html"]
43
+
44
  CMD ["python3", "app.py"]
Makefile CHANGED
@@ -2,12 +2,13 @@
2
  DOCKER_IMAGE_NAME = folding-studio
3
  DOCKER_IMAGE_TAG = latest
4
  PORT = 7860
 
5
 
6
  # Docker build arguments
7
  DOCKER_BUILD_ARGS = --build-arg FOLDING_API_KEY=${FOLDING_API_KEY} --build-arg FOLDING_PROJECT_CODE=${FOLDING_PROJECT_CODE}
8
 
9
  # Docker run arguments
10
- DOCKER_RUN_ARGS = -p $(PORT):$(PORT)
11
 
12
  # Default target
13
  .DEFAULT_GOAL := help
@@ -31,6 +32,7 @@ build:
31
  # Run targets
32
  .PHONY: run
33
  run:
 
34
  docker run $(DOCKER_RUN_ARGS) $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
35
 
36
  # Cleanup targets
 
2
  DOCKER_IMAGE_NAME = folding-studio
3
  DOCKER_IMAGE_TAG = latest
4
  PORT = 7860
5
+ OUTPUT_DIR = ./output
6
 
7
  # Docker build arguments
8
  DOCKER_BUILD_ARGS = --build-arg FOLDING_API_KEY=${FOLDING_API_KEY} --build-arg FOLDING_PROJECT_CODE=${FOLDING_PROJECT_CODE}
9
 
10
  # Docker run arguments
11
+ DOCKER_RUN_ARGS = -p $(PORT):$(PORT) -v $(OUTPUT_DIR):/app/output/html
12
 
13
  # Default target
14
  .DEFAULT_GOAL := help
 
32
  # Run targets
33
  .PHONY: run
34
  run:
35
+ mkdir -p $(OUTPUT_DIR)
36
  docker run $(DOCKER_RUN_ARGS) $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
37
 
38
  # Cleanup targets
app.py CHANGED
@@ -26,7 +26,7 @@ def predict(sequence: str):
26
  logger.info(f"Predicting {seq_file.stem} with project code {FOLDING_PROJECT_CODE}")
27
  output_dir = Path("boltz_results")
28
  output_dir.mkdir(parents=True, exist_ok=True)
29
- boltz_predict(source=seq_file, project_code=FOLDING_PROJECT_CODE, output=output_dir, unzip=True)
30
  logger.info("Prediction done. Output directory: %s", output_dir)
31
  outs = list(output_dir.rglob("*_model_0.cif"))
32
  logger.info("Output files: %s", outs)
 
26
  logger.info(f"Predicting {seq_file.stem} with project code {FOLDING_PROJECT_CODE}")
27
  output_dir = Path("boltz_results")
28
  output_dir.mkdir(parents=True, exist_ok=True)
29
+ # boltz_predict(source=seq_file, project_code=FOLDING_PROJECT_CODE, output=output_dir, unzip=True)
30
  logger.info("Prediction done. Output directory: %s", output_dir)
31
  outs = list(output_dir.rglob("*_model_0.cif"))
32
  logger.info("Output files: %s", outs)
molecule.py CHANGED
@@ -290,9 +290,10 @@ def molecule(
290
  </script>
291
  </body></html>"""
292
  )
293
-
294
- return f"""<iframe style="width: 800px; height: 1300px" name="result" allow="midi; geolocation; microphone; camera;
295
- display-capture; encrypted-media;" sandbox="allow-modals allow-forms
296
- allow-scripts allow-same-origin allow-popups
297
- allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
298
- allowpaymentrequest="" frameborder="0" srcdoc='{x}'></iframe>"""
 
 
290
  </script>
291
  </body></html>"""
292
  )
293
+
294
+ # Save the HTML output to a file
295
+ output_path = "/app/output/html/molecule_view.html"
296
+ with open(output_path, "w") as f:
297
+ f.write(x)
298
+
299
+ return x
pred.cif ADDED
The diff for this file is too large to render. See raw diff