File size: 3,220 Bytes
dcf0f1b
5f234f4
dcf0f1b
5f234f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dcf0f1b
 
5f234f4
dcf0f1b
 
5f234f4
 
 
dcf0f1b
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import gradio as gr
import importlib

def test_all_libraries():
    """Check all library versions and import status"""
    
    libraries = [
        'OCP',
        'gradio',
        'gmsh',
        'numpy',
        'pandas',
        'sklearn',
        'torch',
        'matplotlib',
        'joblib'
    ]
    
    results = []
    results.append("=" * 70)
    results.append("Library Import Test Report")
    results.append("=" * 70)
    results.append("")
    
    for lib_name in libraries:
        try:
            # Handle special module names
            if lib_name == 'OCP':
                module = importlib.import_module('OCP.STEPControl')
                display_name = 'OCP (pythonocc-core)'
            elif lib_name == 'sklearn':
                module = importlib.import_module('sklearn')
                display_name = 'scikit-learn'
            else:
                module = importlib.import_module(lib_name)
                display_name = lib_name
            
            # Get version
            if hasattr(module, '__version__'):
                version = module.__version__
            else:
                # For OCP, get top-level version
                try:
                    ocp_module = importlib.import_module('OCP')
                    version = getattr(ocp_module, '__version__', 'N/A')
                except:
                    version = 'N/A'
            
            results.append(f"✅ {display_name:<28} | Version: {version}")
        
        except ImportError as e:
            results.append(f"❌ {lib_name:<28} | Import Error: {str(e)}")
        except Exception as e:
            results.append(f"⚠️  {lib_name:<28} | Error: {str(e)}")
    
    results.append("")
    results.append("=" * 70)
    results.append("📋 Summary & Instructions for GUI Team")
    results.append("=" * 70)
    results.append("")
    results.append("✅ All core libraries are successfully installed!")
    results.append("")
    results.append("Key Libraries:")
    results.append("  • OCP (pythonocc-core): For STEP file parsing & 3D geometry")
    results.append("  • gmsh: For mesh generation and manipulation")
    results.append("  • numpy/pandas: For numerical and data processing")
    results.append("  • torch: For deep learning models")
    results.append("  • scikit-learn: For machine learning preprocessing")
    results.append("  • matplotlib: For visualization and plotting")
    results.append("  • gradio: For web UI interface")
    results.append("")
    results.append("Next Steps:")
    results.append("  1. Import OCP modules: from OCP.STEPControl import STEPControl_Reader")
    results.append("  2. Use gmsh for mesh operations: import gmsh")
    results.append("  3. Build your Gradio interface with these libraries")
    results.append("")
    results.append("=" * 70)
    
    return "\n".join(results)

interface = gr.Interface(
    fn=test_all_libraries,
    inputs=None,
    outputs="text",
    title="OCP Environment Test Space",
    description="Verify all library versions and import status for deployment",
    allow_flagging="never"
)

if __name__ == "__main__":
    interface.launch(server_name="0.0.0.0", server_port=7860, share=False)