Spaces:
Sleeping
Sleeping
Create docling.py
Browse files- docling.py +39 -0
docling.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
st.title("Install Docling")
|
| 5 |
+
|
| 6 |
+
# Bash script to install Docling
|
| 7 |
+
bash_script = """
|
| 8 |
+
#!/bin/bash
|
| 9 |
+
|
| 10 |
+
# Clone the Docling repository
|
| 11 |
+
git clone https://github.com/IBM/docling.git
|
| 12 |
+
|
| 13 |
+
# Navigate to the Docling directory
|
| 14 |
+
cd docling
|
| 15 |
+
|
| 16 |
+
# Install Docling
|
| 17 |
+
pip install .
|
| 18 |
+
|
| 19 |
+
# Remove the cloned repository (optional)
|
| 20 |
+
# rm -rf ../docling
|
| 21 |
+
|
| 22 |
+
echo "Docling installed successfully!"
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
# Create a temporary bash script file
|
| 26 |
+
with open("install_docling.sh", "w") as f:
|
| 27 |
+
f.write(bash_script)
|
| 28 |
+
|
| 29 |
+
# Make the script executable
|
| 30 |
+
os.chmod("install_docling.sh", 0o755)
|
| 31 |
+
|
| 32 |
+
# Run the bash script
|
| 33 |
+
if st.button("Install Docling"):
|
| 34 |
+
with st.spinner("Installing Docling..."):
|
| 35 |
+
result = os.popen("./install_docling.sh").read()
|
| 36 |
+
st.code(result, language="bash")
|
| 37 |
+
|
| 38 |
+
# Clean up the script file
|
| 39 |
+
os.remove("install_docling.sh")
|