Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,22 @@ from simple_salesforce import Salesforce
|
|
| 13 |
# Configure logging
|
| 14 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
# Try to import plotly
|
| 17 |
try:
|
| 18 |
import plotly.express as px
|
|
@@ -677,6 +693,8 @@ try:
|
|
| 677 |
.table tr:nth-child(even) {background-color: #f9f9f9;}
|
| 678 |
""") as iface:
|
| 679 |
gr.Markdown("<h1>LabOps Log Analyzer Dashboard</h1>")
|
|
|
|
|
|
|
| 680 |
gr.Markdown("Upload a CSV file to analyze. Click 'Analyze' to refresh the dashboard. Use 'Export PDF' for report download. Date Range can be [start, end] (e.g., [-45, -28] for June 1 to June 18) or a single integer (e.g., -30 for June 15).")
|
| 681 |
|
| 682 |
last_modified_state = gr.State(value=None)
|
|
|
|
| 13 |
# Configure logging
|
| 14 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
| 15 |
|
| 16 |
+
# Check and import required libraries
|
| 17 |
+
required_libs = {
|
| 18 |
+
"pandas": "pandas>=1.0.0",
|
| 19 |
+
"plotly": "plotly>=5.0.0",
|
| 20 |
+
"reportlab": "reportlab>=3.0.0",
|
| 21 |
+
"scikit-learn": "scikit-learn>=0.24.0"
|
| 22 |
+
}
|
| 23 |
+
missing_libs = []
|
| 24 |
+
for lib, version in required_libs.items():
|
| 25 |
+
try:
|
| 26 |
+
__import__(lib)
|
| 27 |
+
logging.info(f"{lib} module successfully imported")
|
| 28 |
+
except ImportError:
|
| 29 |
+
logging.warning(f"{lib} module not found. Install {version} for full functionality.")
|
| 30 |
+
missing_libs.append(lib)
|
| 31 |
+
|
| 32 |
# Try to import plotly
|
| 33 |
try:
|
| 34 |
import plotly.express as px
|
|
|
|
| 693 |
.table tr:nth-child(even) {background-color: #f9f9f9;}
|
| 694 |
""") as iface:
|
| 695 |
gr.Markdown("<h1>LabOps Log Analyzer Dashboard</h1>")
|
| 696 |
+
if missing_libs:
|
| 697 |
+
gr.Markdown(f"**Warning:** Missing required libraries: {', '.join(missing_libs)}. Install them via `pip install {' '.join([f'{lib}>=x.x.x' for lib in missing_libs])}` for full functionality.")
|
| 698 |
gr.Markdown("Upload a CSV file to analyze. Click 'Analyze' to refresh the dashboard. Use 'Export PDF' for report download. Date Range can be [start, end] (e.g., [-45, -28] for June 1 to June 18) or a single integer (e.g., -30 for June 15).")
|
| 699 |
|
| 700 |
last_modified_state = gr.State(value=None)
|