Spaces:
Sleeping
Sleeping
#!/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 | |
) |