Skip to content

Instantly share code, notes, and snippets.

@churnikov
Created August 15, 2023 18:03
Show Gist options
  • Save churnikov/2d5001428c8a7d7ddc40429b9b4e2c58 to your computer and use it in GitHub Desktop.
Save churnikov/2d5001428c8a7d7ddc40429b9b4e2c58 to your computer and use it in GitHub Desktop.
stlite ketcher non-working example

I created a file using stlite and streamlit-ketcher

Unfortunately, it is not working, and I don't have time right now to figure out why. Just going to leave it here for now

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<title>stlite app</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@stlite/mountable@0.34.0/build/stlite.css"
/>
</head>
<body>
<div id="root"></div>
<script src="https://cdn.jsdelivr.net/npm/@stlite/mountable@0.34.0/build/stlite.js"></script>
<script>
stlite.mount(
{
requirements: ["streamlit-ketcher"], // Packages to install
entrypoint: "streamlit_app.py", // The target file of the `streamlit run` command
files: {
"streamlit_app.py": `
import streamlit as st
from streamlit_ketcher import st_ketcher
molecule = st.text_input("Molecule", "CCO")
smile_code = st_ketcher(molecule)
st.markdown(f"Smile code: {smile_code}")
`,
},
},
document.getElementById("root")
);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment