Spaces:
Build error
Build error
Commit ·
2721bc2
1
Parent(s): 361df8a
added processors
Browse files
app.py
CHANGED
|
@@ -7,6 +7,8 @@ client = Groq(
|
|
| 7 |
api_key="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",
|
| 8 |
)
|
| 9 |
|
|
|
|
|
|
|
| 10 |
# Streamlit app title
|
| 11 |
st.title("Product Detection App")
|
| 12 |
|
|
@@ -15,7 +17,8 @@ uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png
|
|
| 15 |
|
| 16 |
if uploaded_file is not None:
|
| 17 |
image = Image.open(uploaded_file)
|
| 18 |
-
|
|
|
|
| 19 |
# Process the image and make predictions
|
| 20 |
inputs = processor(images=image, return_tensors="pt")
|
| 21 |
outputs = model(**inputs)
|
|
|
|
| 7 |
api_key="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",
|
| 8 |
)
|
| 9 |
|
| 10 |
+
model_id = 'google/vit-base-patch16-224'
|
| 11 |
+
|
| 12 |
# Streamlit app title
|
| 13 |
st.title("Product Detection App")
|
| 14 |
|
|
|
|
| 17 |
|
| 18 |
if uploaded_file is not None:
|
| 19 |
image = Image.open(uploaded_file)
|
| 20 |
+
processor = ViTImageProcessor.from_pretrained(model_id)
|
| 21 |
+
model = ViTForImageClassification.from_pretrained(model_id)
|
| 22 |
# Process the image and make predictions
|
| 23 |
inputs = processor(images=image, return_tensors="pt")
|
| 24 |
outputs = model(**inputs)
|