kanneboinakumar commited on
Commit
3447370
·
verified ·
1 Parent(s): 8f4ac15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -77,9 +77,9 @@ model.eval()
77
  uploaded_img = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
78
 
79
  if uploaded_img is not None:
80
- # Display uploaded image
81
  image = Image.open(uploaded_img)
82
- st.image(image, caption="Uploaded Image", use_container_width =True)
83
 
84
  # Image transformations
85
  sample_transform = transforms.Compose([
@@ -94,6 +94,13 @@ if uploaded_img is not None:
94
  # Model inference
95
  with torch.no_grad():
96
  pred = model(transformed_img).argmax(dim=1).item()
97
-
98
- # Display prediction
99
- st.success(f"Predicted Class: {class_names[pred]}")
 
 
 
 
 
 
 
 
77
  uploaded_img = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
78
 
79
  if uploaded_img is not None:
80
+ # Display uploaded image in a smaller size
81
  image = Image.open(uploaded_img)
82
+ st.image(image, caption="Uploaded Image", width=200) # Set width to reduce image size
83
 
84
  # Image transformations
85
  sample_transform = transforms.Compose([
 
94
  # Model inference
95
  with torch.no_grad():
96
  pred = model(transformed_img).argmax(dim=1).item()
97
+
98
+ # Stylish output box
99
+ st.markdown(
100
+ f"""
101
+ <div class="output-container">
102
+ 🧠 <strong>Predicted Class:</strong> {class_names[pred]}
103
+ </div>
104
+ """,
105
+ unsafe_allow_html=True
106
+ )