Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,90 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
interface = gr.Interface(
|
| 8 |
-
fn=
|
| 9 |
inputs=None,
|
| 10 |
outputs="text",
|
| 11 |
-
title="OCP",
|
| 12 |
-
description="
|
|
|
|
| 13 |
)
|
| 14 |
|
| 15 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import importlib
|
| 3 |
|
| 4 |
+
def test_all_libraries():
|
| 5 |
+
"""Check all library versions and import status"""
|
| 6 |
+
|
| 7 |
+
libraries = [
|
| 8 |
+
'OCP',
|
| 9 |
+
'gradio',
|
| 10 |
+
'gmsh',
|
| 11 |
+
'numpy',
|
| 12 |
+
'pandas',
|
| 13 |
+
'sklearn',
|
| 14 |
+
'torch',
|
| 15 |
+
'matplotlib',
|
| 16 |
+
'joblib'
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
+
results = []
|
| 20 |
+
results.append("=" * 70)
|
| 21 |
+
results.append("Library Import Test Report")
|
| 22 |
+
results.append("=" * 70)
|
| 23 |
+
results.append("")
|
| 24 |
+
|
| 25 |
+
for lib_name in libraries:
|
| 26 |
+
try:
|
| 27 |
+
# Handle special module names
|
| 28 |
+
if lib_name == 'OCP':
|
| 29 |
+
module = importlib.import_module('OCP.STEPControl')
|
| 30 |
+
display_name = 'OCP (pythonocc-core)'
|
| 31 |
+
elif lib_name == 'sklearn':
|
| 32 |
+
module = importlib.import_module('sklearn')
|
| 33 |
+
display_name = 'scikit-learn'
|
| 34 |
+
else:
|
| 35 |
+
module = importlib.import_module(lib_name)
|
| 36 |
+
display_name = lib_name
|
| 37 |
+
|
| 38 |
+
# Get version
|
| 39 |
+
if hasattr(module, '__version__'):
|
| 40 |
+
version = module.__version__
|
| 41 |
+
else:
|
| 42 |
+
# For OCP, get top-level version
|
| 43 |
+
try:
|
| 44 |
+
ocp_module = importlib.import_module('OCP')
|
| 45 |
+
version = getattr(ocp_module, '__version__', 'N/A')
|
| 46 |
+
except:
|
| 47 |
+
version = 'N/A'
|
| 48 |
+
|
| 49 |
+
results.append(f"✅ {display_name:<28} | Version: {version}")
|
| 50 |
+
|
| 51 |
+
except ImportError as e:
|
| 52 |
+
results.append(f"❌ {lib_name:<28} | Import Error: {str(e)}")
|
| 53 |
+
except Exception as e:
|
| 54 |
+
results.append(f"⚠️ {lib_name:<28} | Error: {str(e)}")
|
| 55 |
+
|
| 56 |
+
results.append("")
|
| 57 |
+
results.append("=" * 70)
|
| 58 |
+
results.append("📋 Summary & Instructions for GUI Team")
|
| 59 |
+
results.append("=" * 70)
|
| 60 |
+
results.append("")
|
| 61 |
+
results.append("✅ All core libraries are successfully installed!")
|
| 62 |
+
results.append("")
|
| 63 |
+
results.append("Key Libraries:")
|
| 64 |
+
results.append(" • OCP (pythonocc-core): For STEP file parsing & 3D geometry")
|
| 65 |
+
results.append(" • gmsh: For mesh generation and manipulation")
|
| 66 |
+
results.append(" • numpy/pandas: For numerical and data processing")
|
| 67 |
+
results.append(" • torch: For deep learning models")
|
| 68 |
+
results.append(" • scikit-learn: For machine learning preprocessing")
|
| 69 |
+
results.append(" • matplotlib: For visualization and plotting")
|
| 70 |
+
results.append(" • gradio: For web UI interface")
|
| 71 |
+
results.append("")
|
| 72 |
+
results.append("Next Steps:")
|
| 73 |
+
results.append(" 1. Import OCP modules: from OCP.STEPControl import STEPControl_Reader")
|
| 74 |
+
results.append(" 2. Use gmsh for mesh operations: import gmsh")
|
| 75 |
+
results.append(" 3. Build your Gradio interface with these libraries")
|
| 76 |
+
results.append("")
|
| 77 |
+
results.append("=" * 70)
|
| 78 |
+
|
| 79 |
+
return "\n".join(results)
|
| 80 |
|
| 81 |
interface = gr.Interface(
|
| 82 |
+
fn=test_all_libraries,
|
| 83 |
inputs=None,
|
| 84 |
outputs="text",
|
| 85 |
+
title="OCP Environment Test Space",
|
| 86 |
+
description="Verify all library versions and import status for deployment",
|
| 87 |
+
allow_flagging="never"
|
| 88 |
)
|
| 89 |
|
| 90 |
if __name__ == "__main__":
|