File size: 2,378 Bytes
105aff1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""

GATE Motion Analysis - Minimal Deployment Version

Simplified to avoid all API-related issues

"""

import os
import gradio as gr
import numpy as np

def simple_analysis(image, exercise):
    """Simple analysis function that returns mock results."""
    if image is None:
        return None, "No image provided", 0, "Please upload an image"
    
    # Mock analysis
    confidence = np.random.uniform(70, 95)
    status = f"Analysis complete for {exercise}"
    feedback = f"Mock analysis result for {exercise}. Confidence: {confidence:.1f}%"
    
    return image, status, confidence, feedback

def create_minimal_interface():
    """Create a minimal interface without complex features."""
    
    with gr.Blocks(
        title="GATE Motion Analysis - Minimal", 
        analytics_enabled=False
    ) as interface:
        
        gr.Markdown("# GATE Motion Analysis - Minimal Version")
        gr.Markdown("Upload an image and click analyze to test the system.")
        
        with gr.Row():
            with gr.Column():
                image_input = gr.Image(label="Upload Image", type="pil")
                exercise_input = gr.Dropdown(
                    choices=["Squats", "Push-ups", "Lunges"], 
                    value="Squats",
                    label="Exercise"
                )
                analyze_btn = gr.Button("Analyze", variant="primary")
            
            with gr.Column():
                result_image = gr.Image(label="Result")
                status_output = gr.Textbox(label="Status", interactive=False)
                confidence_output = gr.Number(label="Confidence", interactive=False)
                feedback_output = gr.Textbox(label="Feedback", interactive=False)
        
        # Simple click handler
        analyze_btn.click(
            fn=simple_analysis,
            inputs=[image_input, exercise_input],
            outputs=[result_image, status_output, confidence_output, feedback_output]
        )
    
    return interface

if __name__ == "__main__":
    print("🚀 Starting Minimal GATE Motion Analysis...")
    
    # Create and launch with absolute minimal configuration
    interface = create_minimal_interface()
    
    interface.launch(
        share=False,
        show_api=False,
        show_error=True
    )