Spaces:
Sleeping
Sleeping
francoisMav
commited on
Commit
•
0d20d52
1
Parent(s):
67eef93
updated app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# app.py
|
2 |
+
|
3 |
+
import streamlit as st
|
4 |
+
from transformers import pipeline
|
5 |
+
from PIL import Image
|
6 |
+
import requests
|
7 |
+
|
8 |
+
# Load the Hugging Face pipeline for image classification
|
9 |
+
classifier = pipeline("image-classification", model="imfarzanansari/skintelligent-acne")
|
10 |
+
|
11 |
+
# Title of the Streamlit app
|
12 |
+
st.title("Skin Condition Classification - Acne Detection")
|
13 |
+
|
14 |
+
# Upload an image file
|
15 |
+
uploaded_file = st.file_uploader("Choose an image...", type="jpg")
|
16 |
+
|
17 |
+
if uploaded_file is not None:
|
18 |
+
# Display the uploaded image
|
19 |
+
image = Image.open(uploaded_file)
|
20 |
+
st.image(image, caption="Uploaded Image", use_column_width=True)
|
21 |
+
|
22 |
+
# Perform image classification using the Hugging Face pipeline
|
23 |
+
st.write("Classifying...")
|
24 |
+
predictions = classifier(image)
|
25 |
+
|
26 |
+
# Display the results
|
27 |
+
for pred in predictions:
|
28 |
+
st.write(f"Label: {pred['label']}, Score: {pred['score']:.4f}")
|