Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,27 +4,27 @@ import re
|
|
| 4 |
import plotly.express as px
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
def
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
try:
|
| 16 |
-
|
| 17 |
-
except ImportError
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
|
| 22 |
-
ensure_library_installed("camelot", "camelot-py[cv]")
|
| 23 |
-
ensure_library_installed("tabula", "tabula-py")
|
| 24 |
-
ensure_library_installed("pdfplumber")
|
| 25 |
-
ensure_library_installed("plotly")
|
| 26 |
|
| 27 |
-
# Import
|
| 28 |
from transformers import pipeline
|
| 29 |
|
| 30 |
# NLP Model for summarization
|
|
|
|
| 4 |
import plotly.express as px
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
+
# Function to install dependencies using subprocess
|
| 8 |
+
def install_dependencies():
|
| 9 |
+
required_libraries = [
|
| 10 |
+
"torch",
|
| 11 |
+
"camelot-py[cv]",
|
| 12 |
+
"tabula-py",
|
| 13 |
+
"pdfplumber",
|
| 14 |
+
"plotly"
|
| 15 |
+
]
|
| 16 |
+
for library in required_libraries:
|
| 17 |
try:
|
| 18 |
+
__import__(library)
|
| 19 |
+
except ImportError:
|
| 20 |
+
st.write(f"Installing {library}...")
|
| 21 |
+
subprocess.check_call(["pip", "install", library])
|
| 22 |
+
st.write(f"{library} installed successfully.")
|
| 23 |
|
| 24 |
+
# Install dependencies
|
| 25 |
+
install_dependencies()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
# Import required modules after installation
|
| 28 |
from transformers import pipeline
|
| 29 |
|
| 30 |
# NLP Model for summarization
|