import gradio as gr
from transformers import pipeline
from PIL import Image
import numpy as np
def predict_image(image):
pipe = pipeline("image-classification", model="itsTomLie/Jaundice_Classifier")
if isinstance(image, np.ndarray):
image = Image.fromarray(image.astype('uint8'))
elif isinstance(image, str):
image = Image.open(image)
result = pipe(image)
label = result[0]['label']
confidence = result[0]['score']
print(f"Prediction: {label}, Confidence: {confidence}")
return label, confidence
interface = gr.Interface(
fn=predict_image,
inputs=gr.Image(type="numpy", label="Upload an Image"),
outputs=[gr.Textbox(label="Prediction"), gr.Textbox(label="Confidence")]
)
interface.launch(debug=True)
Model Card for Model ID
Model Details
Model Description
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
Developed by: [More Information Needed]
Funded by [optional]: [More Information Needed]
Shared by [optional]: [More Information Needed]
Model type: [More Information Needed]
Language(s) (NLP): [More Information Needed]
License: [More Information Needed]
Finetuned from model [optional]: [More Information Needed]
Model Sources [optional]
Repository: [More Information Needed]
Paper [optional]: [More Information Needed]
Demo [optional]: [More Information Needed]
Uses
Direct Use
[More Information Needed]
Downstream Use [optional]
[More Information Needed]
Out-of-Scope Use
[More Information Needed]
Bias, Risks, and Limitations
[More Information Needed]
Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.