Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -131,33 +131,32 @@ def sample_images():
|
|
| 131 |
st.header("Sample Images")
|
| 132 |
|
| 133 |
# Sample images
|
| 134 |
-
|
| 135 |
"Sample 1": "img_0002.jpg",
|
| 136 |
}
|
| 137 |
|
| 138 |
# Button to load sample images
|
| 139 |
if st.button("Load Sample Images"):
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
if
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
st.write(prediction_result)
|
| 161 |
|
| 162 |
def upload_image():
|
| 163 |
st.header("Upload Image")
|
|
|
|
| 131 |
st.header("Sample Images")
|
| 132 |
|
| 133 |
# Sample images
|
| 134 |
+
example_image = {
|
| 135 |
"Sample 1": "img_0002.jpg",
|
| 136 |
}
|
| 137 |
|
| 138 |
# Button to load sample images
|
| 139 |
if st.button("Load Sample Images"):
|
| 140 |
+
|
| 141 |
+
sample_image = Image.open(example_image).convert('RGB')
|
| 142 |
+
st.image(sample_image, caption=f"{sample_name} Image.", use_column_width=True)
|
| 143 |
+
|
| 144 |
+
# Text input for each sample image
|
| 145 |
+
text_input = st.text_area(f"Input Question for {sample_name}:")
|
| 146 |
+
|
| 147 |
+
# Predict button for each sample image
|
| 148 |
+
if st.button(f"Predict"):
|
| 149 |
+
if text_input:
|
| 150 |
+
# Perform prediction
|
| 151 |
+
prediction_result = predict(sample_image, text_input)
|
| 152 |
+
|
| 153 |
+
# Display input text
|
| 154 |
+
st.subheader(f"Input Question for {"Example Image"}:")
|
| 155 |
+
st.write(text_input)
|
| 156 |
+
|
| 157 |
+
# Display prediction result
|
| 158 |
+
st.subheader(f"Prediction Result for {"Example Image"}:")
|
| 159 |
+
st.write(prediction_result)
|
|
|
|
| 160 |
|
| 161 |
def upload_image():
|
| 162 |
st.header("Upload Image")
|