Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Basic Interfaces and CI/CD for web interface #212

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
3637959
Added workflow file for deployment
JackyZzZz Jun 16, 2024
afd0525
Added Main Page for the interface
JackyZzZz Jun 16, 2024
fc38712
Added some images for the interface
JackyZzZz Jun 16, 2024
b73665a
Added the MaxMin interface
JackyZzZz Jun 16, 2024
6bafce4
Added the Dockerfile
JackyZzZz Jun 16, 2024
f7bc6c4
Added the configuration file for HuggingFace
JackyZzZz Jun 16, 2024
4bca7cd
Added streamlit in the dependencies
JackyZzZz Jun 16, 2024
541f8f1
Added the option of heading in csv and xlsx file
JackyZzZz Jun 16, 2024
36f601a
Added visualization and better support for numpy array files
JackyZzZz Jun 17, 2024
f996882
Added some error handling for MaxMin interface
JackyZzZz Jun 17, 2024
4fd4492
Use git-lfs to track xlsx files
JackyZzZz Jun 17, 2024
b3bdd90
Remove binary files before deployment
JackyZzZz Jun 17, 2024
02590c3
Removed gitattributes file
JackyZzZz Jun 17, 2024
a722d3b
Added some info about the org
JackyZzZz Jun 17, 2024
e4ca43a
Added some background color
JackyZzZz Jun 17, 2024
423d1d8
Added workflow file for deployment
JackyZzZz Jun 16, 2024
ceeef3f
Added Main Page for the interface
JackyZzZz Jun 16, 2024
b53e581
Added some images for the interface
JackyZzZz Jun 16, 2024
f521f26
Added the MaxMin interface
JackyZzZz Jun 16, 2024
0c37793
Added the Dockerfile
JackyZzZz Jun 16, 2024
ef5c187
Added the configuration file for HuggingFace
JackyZzZz Jun 16, 2024
c77ab5b
Added streamlit in the dependencies
JackyZzZz Jun 16, 2024
4643281
Added the option of heading in csv and xlsx file
JackyZzZz Jun 16, 2024
52823a2
Added visualization and better support for numpy array files
JackyZzZz Jun 17, 2024
7634a97
Added some error handling for MaxMin interface
JackyZzZz Jun 17, 2024
2e0c79a
Use git-lfs to track xlsx files
JackyZzZz Jun 17, 2024
9c5b04c
Remove binary files before deployment
JackyZzZz Jun 17, 2024
65bf7bd
Removed gitattributes file
JackyZzZz Jun 17, 2024
c681970
Added some info about the org
JackyZzZz Jun 17, 2024
1fd5f99
Added some background color
JackyZzZz Jun 17, 2024
b3e7754
Modified the branch that triggers Github Actions
JackyZzZz Jun 19, 2024
c98835d
Use the latest checkout version
JackyZzZz Jun 19, 2024
61d3c12
Use the latest release of setup-python and python version
JackyZzZz Jun 19, 2024
c672e5b
Removed unused dependencies and added an empty line
JackyZzZz Jun 19, 2024
d9a8afb
Updated python version and added an empty line
JackyZzZz Jun 19, 2024
94bb529
Removed streamlit from package dependencies
JackyZzZz Jun 19, 2024
7be242d
Added license for streamlit interfaces
JackyZzZz Jun 19, 2024
75ff707
Modified the name for the package
JackyZzZz Jun 19, 2024
a82282f
Modified the name for the file
JackyZzZz Jun 19, 2024
a0b5847
Modified the name for the file
JackyZzZz Jun 19, 2024
e671201
Removed symbolic text
JackyZzZz Jun 19, 2024
1314ba8
Fixed some code convention
JackyZzZz Jun 19, 2024
65bd637
Merged some changes
JackyZzZz Jun 19, 2024
77507f0
Changed strategy to setup
JackyZzZz Jun 20, 2024
ed6feb4
Remove streamlit from package dependencies
JackyZzZz Jun 20, 2024
14e751d
Delete the origin MaxMin file
JackyZzZz Jun 20, 2024
8149b82
Remove symbolic text
JackyZzZz Jun 20, 2024
b169fe9
Fixed a typo
JackyZzZz Jun 20, 2024
20a988a
Merge branch 'main' of https://github.com/JackyZzZz/Selector into unc…
JackyZzZz Jun 25, 2024
a8c6475
Comment the docker pushing for now
JackyZzZz Jun 27, 2024
0dfb9f8
Update the destination for deployment on HuggingFace
JackyZzZz Jun 27, 2024
560bcf8
Push current branch to HuggingFace
JackyZzZz Jun 28, 2024
1b4d508
Merge branch 'main' of https://github.com/JackyZzZz/Selector into unc…
JackyZzZz Jun 30, 2024
d22e318
Update the workflow
JackyZzZz Jul 2, 2024
e02b218
Update the workflow
JackyZzZz Jul 2, 2024
b809e62
Update the workflow
JackyZzZz Jul 2, 2024
0cba334
Update the dockerhub info
JackyZzZz Jul 2, 2024
65db0b9
Update the env for HuggingFace
JackyZzZz Jul 2, 2024
50c1e57
Update the env for HuggingFace
JackyZzZz Jul 2, 2024
4cb0348
Test the deployment
JackyZzZz Jul 11, 2024
6a50aca
Test the deployment
JackyZzZz Jul 11, 2024
ce0309c
Test the deployment
JackyZzZz Jul 12, 2024
7ddcb4f
Test the deployment
JackyZzZz Jul 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/interface_auto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Deployment on DockerHub and Hugging Face

# Trigger the workflow on push and pull request events to the 'main' or 'master' branch
on:
push:
branches:
- "master"
- "main"
- "test"
pull_request:
branches:
- "master"
- "main"

jobs:
build-and-deploy:
# Run the job on the latest Ubuntu runner
runs-on: ubuntu-latest

steps:
# Step 1: Check out the latest code from the repository
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true

# Step 2: Set up Git LFS
- name: Set up Git LFS
run: |
git lfs install
git lfs pull
# Step 3: Remove binary files from git history
- name: Remove binary files from git history
run: |
git filter-branch --force --index-filter \
"git rm --cached --ignore-unmatch DiverseSelector/test/test2/BBB_SECFP6_1024.xlsx DiverseSelector/test/test2/BBB_SECFP6_2048.xlsx" \
--prune-empty --tag-name-filter cat -- --all
# Step 4: Set up Python environment with version 3.11
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11

# Step 5: Install the required dependencies
- name: Install dependencies
run: |
pip install -r requirements.txt
# Step 6: Build the Docker image to Docker Hub
- name: Build Docker image
run: |
docker build . -t qcdevs/selector:latest
# Step 7: Push the Docker image to Docker Hub
- name: Push Docker image
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
docker login -u qcdevs -p $DOCKERHUB_TOKEN
docker push qcdevs/selector:latest
# Step 8: Replace the README.md file for Hugging Face
- name: Replace README for Hugging Face
run: |
mv README_hf.md README.md
git config --global user.name "github-actions[bot]"
git config --global user.email "[email protected]"
git add README.md
git commit -m "Replace README.md with README_hf.md for Hugging Face"
# Step 9: Push the app to Hugging Face
- name: Push to Hugging Face
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git push https://QCDevs:[email protected]/spaces/QCDevs/selector HEAD:main --force
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Use the official image as a parent image
FROM python:3.11-slim

# Set the working directory in the container
WORKDIR /app

# Install system dependencies required for building packages
RUN apt-get update && \
apt-get install -y build-essential && \
apt-get clean

# Copy the requirements file into the container
COPY requirements.txt requirements.txt
COPY requirements_dev.txt requirements_dev.txt

# Upgrade pip, setuptools, and wheel
RUN pip install --upgrade pip setuptools wheel

# Install the dependencies using --use-pep517
RUN pip install --use-pep517 --no-cache-dir -r requirements.txt
RUN pip install --use-pep517 --no-cache-dir -r requirements_dev.txt
RUN pip install --use-pep517 --no-cache-dir streamlit

# Copy the rest of the application code
COPY . .

# Install the Selector package using PEP 517 standards-based tools
RUN pip install --use-pep517 .

# Expose the port the app runs on
EXPOSE 8501

# Command to run the app
CMD ["streamlit", "run", "streamlit_app/app.py", "--server.enableXsrfProtection=false"]
8 changes: 8 additions & 0 deletions README_hf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: QC-Selector
emoji: 🐳
colorFrom: purple
colorTo: gray
sdk: docker
app_port: 8501
---
99 changes: 99 additions & 0 deletions streamlit_app/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# The Selector library provides a set of tools for selecting a
# subset of the dataset and computing diversity.
#
# Copyright (C) 2023 The QC-Devs Community
#
# This file is part of Selector.
#
# Selector is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# Selector is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
# --

import streamlit as st
JackyZzZz marked this conversation as resolved.
Show resolved Hide resolved
import os


# Get the current directory path
current_dir = os.path.dirname(os.path.abspath(__file__))

# Construct the path to the assets directory
assets_dir = os.path.join(current_dir, "assets")

# Set page configuration
st.set_page_config(
page_title = "QC-Selector",
page_icon = os.path.join(assets_dir, "QC-Devs.png"),
)

st.image(os.path.join(assets_dir, "selector_logo.png"))

st.write("# Welcome to QC-Selector! 👋")

st.sidebar.success("Select an algorithm to get started.")

st.info("👈 Select an algorithm from the sidebar to see some examples of what QC-Selector can do!")

st.markdown(
"""
[selector](https://github.com/theochem/Selector) is a free, open-source, and cross-platform
Python library designed to help you effortlessly identify the most diverse subset of molecules
from your dataset.
Please use the following citation in any publication using selector library:

**“Selector: A Generic Python Package for Subset Selection”**, Fanwang Meng, Alireza Tehrani,
Valerii Chuiko, Abigail Broscius, Abdul, Hassan, Maximilian van Zyl, Marco Martínez González,
Yang, Ramón Alain Miranda-Quintana, Paul W. Ayers, and Farnaz Heidar-Zadeh”

The selector source code is hosted on [GitHub](https://github.com/theochem/Selector)
and is released under the [GNU General Public License v3.0](https://github.com/theochem/Selector/blob/main/LICENSE).
We welcome any contributions to the selector library in accordance with our Code of Conduct;
please see our [Contributing Guidelines](https://qcdevs.org/guidelines/qcdevs_code_of_conduct/).
Please report any issues you encounter while using
selector library on [GitHub Issues](https://github.com/theochem/Selector/issues).
For further information and inquiries please contact us at [email protected].

### Why QC-Selector?
In the world of chemistry, selecting the right subset of molecules is critical for a wide
range of applications, including drug discovery, materials science, and molecular optimization.
QC-Selector offers a cutting-edge solution to streamline this process, empowering researchers,
scientists, and developers to make smarter decisions faster.

### Key Features
1. Import Your Dataset: Simply import your molecule dataset in various file formats, including SDF, SMILES, and InChi, to get started.

2. Define Selection Criteria: Specify the desired level of diversity and other relevant parameters to tailor the subset selection to your unique requirements.

3. Run the Analysis: Let QC-Selector’s powerful algorithms process your dataset and efficiently select the most diverse molecules.

4. Export: Explore the diverse subset and export the results for further analysis and integration into your projects.
"""
)

st.sidebar.title("About QC-Devs")

st.sidebar.info("QC-Devs develops various free, open-source, and cross-platform libraries for scientific computing, especially theoretical and computational chemistry. Our goal is to make programming accessible to chemists and promote precepts of sustainable software development. For further information and inquiries please contact us at [email protected].")

# Add icons to the sidebar
st.sidebar.markdown(
"""
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div style="text-align: center;">
<a href="https://qcdevs.org/" target="_blank"><i class="fa fa-home" style="font-size:24px"></i> WEBSITE</a><br>
<a href="mailto:[email protected]"><i class="fa fa-envelope" style="font-size:24px"></i> EMAIL</a><br>
<a href="https://github.com/theochem" target="_blank"><i class="fa fa-github" style="font-size:24px"></i> GITHUB</a><br>
© 2024 QC-Devs. All rights reserved.
</div>
""",
unsafe_allow_html=True
)
Binary file added streamlit_app/assets/QC-Devs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added streamlit_app/assets/selector_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading