Update app.py
Browse files17 unmodified lines1819202122232425262728293017 unmodified lines# Function to classify posture imagesdef classify_image(image):if image is None:return "No image provided!"image = transform(image).unsqueeze(0)output = model(image)_, predicted = torch.max(output, 1)return "Good Posture! Sit exactly like that for your Interview!" if predicted.item() == 0 else "Bad Posture, you should think of sitting a little straighter or more in frame for your real interview."# Set up Gradio interfaceiface = gr.Interface(fn=classify_image, inputs=gr.Image(type="pil", height=150, width=150), outputs="text")iface.launch()17 unmodified lines1819202122232425262728293031323334353617 unmodified lines# Function to classify posture imagesdef classify_image(image):if image is None:return "No image provided! Please capture or upload an image."image = transform(image).unsqueeze(0)output = model(image)_, predicted = torch.max(output, 1)return ("Good Posture! Sit exactly like that for your Interview!"if predicted.item() == 0else "Bad Posture, you should think of sitting a little straighter or more in frame for your real interview.")# Create a compact Gradio layout using Blockswith gr.Blocks() as demo:gr.Markdown("### Posture Classifier")img_input = gr.Image
app.py+11-5