Spaces:
Sleeping
Sleeping
Update app.py
Browse files86 unmodified lines8788899091929316 unmodified lines11011111211311411511686 unmodified lines# Dictionary mapping all candidate labels to their predicted probabilitiesprob_dict = {label_lookup[output['label']]: round(output["score"], 4) for output in outputs}predicted_label_str = f"This image shows {outputs[0]['label']} | Confidence (probability): {100*outputs[0]['score']:.1f}%" if outputs[0]['score'] > prob_threshold else "No prediction"return predicted_label_str, prob_dict16 unmodified linesfn = run_classifer,inputs = [gradio.Dropdown(["CLIP-base", "CLIP-large", "SigLIP-base", "SigLIP-large"], value="CLIP-large", label = "Select Classifier"),gradio.Image(type="pil", label="Load sample image here"),gradio.Slider(minimum = 0.1, maximum = 0.9, step = 0.05, value = 0.25, label = "Set Prediction Threshold")],outputs = [gradio.Textbox(label="Image Classification"),86 unmodified lines878889909192939416 unmodified lines11111211311411511611786 unmodified lines# Dictionary mapping all candidate labels to their predicted probabilitiesprob_dict = {label_lookup[output['label']]: round(output["score"], 4) for output in outputs}# predicted_label_str = f"This image shows {outputs[0]['label']} | Confidence (probability): {100*outputs[0]['score']:.1f}%" if outputs[0]['score'] > prob_threshold else "No prediction"predicted_label_str = f"This image shows {outputs[0]['label']} | Confidence (probability): {100*outputs[0]['score']:.1f}%"return predicted_label_str, prob_dict16 unmodified linesfn = run_classifer,inputs = [gradio.Dropdown(["CLIP-base", "CLIP-large", "SigLIP-base", "SigLIP-large"], value="CLIP-large", label = "Select Classifier"),gradio.Image(type="pil", label="Load sample image here"),# gradio.Slider(minimum = 0.1, maximum = 0.9, step = 0.05, value = 0.25, label = "Set Prediction Threshold")],outputs = [gradio.Textbox(label="Image Classification"),
app.py+3-2