Spaces:
Runtime error
Runtime error
Update app.py
Browse files4 unmodified lines5678910111213141516171819202122232425262728293031323334353637383940414243444 unmodified linesimport randomimport whisperfrom pydub import AudioSegmentimport torchimport torchvision.transforms as transformsimport torchvision.models as modelsfrom PIL import Image
# Load ResNet18 modelmodel = models.resnet18(weights=models.ResNet18_Weights.IMAGENET1K_V1)model.fc = torch.nn.Linear(model.fc.in_features, 2) # Adjust for two classesmodel.eval()
# Define image transformationtransform = transforms.Compose([ transforms.Resize((224, 224)), transforms.ToTensor()])
# Function to classify posture imagesdef classify_image(image): if image is None: return "No image provided! Please upload or capture 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() == 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"), outputs="text")iface.launch()
# uploading and cleaning the knowledge txt filedef load_questions(file_path):app.py+34