Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -141,7 +141,7 @@ def process_image(img):
|
|
| 141 |
generated_image = Image.open(io.BytesIO(response.content))
|
| 142 |
|
| 143 |
print("Image retrieved and ready to return")
|
| 144 |
-
return classification_results, generated_image, wiki_url, endangerment_status
|
| 145 |
|
| 146 |
|
| 147 |
|
|
@@ -149,9 +149,9 @@ def process_image(img):
|
|
| 149 |
def clear_outputs():
|
| 150 |
return {
|
| 151 |
label_output: None,
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
status_output: None # β NEW
|
| 155 |
}
|
| 156 |
|
| 157 |
|
|
@@ -169,9 +169,9 @@ with gr.Blocks() as demo:
|
|
| 169 |
with gr.Row():
|
| 170 |
with gr.Column():
|
| 171 |
label_output = gr.Label(label="Classification Results")
|
| 172 |
-
wiki_output = gr.Textbox(label="Wikipedia Article Link", lines=1)
|
| 173 |
-
status_output = gr.Textbox(label="Endangerment Status", lines=1) # β NEW
|
| 174 |
-
generated_image = gr.Image(label="AI Generated Interpretation")
|
| 175 |
|
| 176 |
# Add example images using local paths
|
| 177 |
gr.Examples(
|
|
@@ -179,19 +179,19 @@ with gr.Blocks() as demo:
|
|
| 179 |
inputs=input_image,
|
| 180 |
examples_per_page=6,
|
| 181 |
fn=process_image,
|
| 182 |
-
outputs=[label_output
|
| 183 |
)
|
| 184 |
|
| 185 |
input_image.change(
|
| 186 |
fn=process_image,
|
| 187 |
inputs=input_image,
|
| 188 |
-
outputs=[label_output
|
| 189 |
)
|
| 190 |
|
| 191 |
input_image.clear(
|
| 192 |
fn=clear_outputs,
|
| 193 |
inputs=[],
|
| 194 |
-
outputs=[label_output
|
| 195 |
)
|
| 196 |
|
| 197 |
|
|
|
|
| 141 |
generated_image = Image.open(io.BytesIO(response.content))
|
| 142 |
|
| 143 |
print("Image retrieved and ready to return")
|
| 144 |
+
return classification_results, #generated_image, wiki_url, endangerment_status
|
| 145 |
|
| 146 |
|
| 147 |
|
|
|
|
| 149 |
def clear_outputs():
|
| 150 |
return {
|
| 151 |
label_output: None,
|
| 152 |
+
# generated_image: None,
|
| 153 |
+
# wiki_output: None,
|
| 154 |
+
#status_output: None # β NEW
|
| 155 |
}
|
| 156 |
|
| 157 |
|
|
|
|
| 169 |
with gr.Row():
|
| 170 |
with gr.Column():
|
| 171 |
label_output = gr.Label(label="Classification Results")
|
| 172 |
+
#wiki_output = gr.Textbox(label="Wikipedia Article Link", lines=1)
|
| 173 |
+
#status_output = gr.Textbox(label="Endangerment Status", lines=1) # β NEW
|
| 174 |
+
#generated_image = gr.Image(label="AI Generated Interpretation")
|
| 175 |
|
| 176 |
# Add example images using local paths
|
| 177 |
gr.Examples(
|
|
|
|
| 179 |
inputs=input_image,
|
| 180 |
examples_per_page=6,
|
| 181 |
fn=process_image,
|
| 182 |
+
outputs=[label_output]#, generated_image, wiki_output, status_output] # β UPDATED
|
| 183 |
)
|
| 184 |
|
| 185 |
input_image.change(
|
| 186 |
fn=process_image,
|
| 187 |
inputs=input_image,
|
| 188 |
+
outputs=[label_output]#, generated_image, wiki_output, status_output] # β UPDATED
|
| 189 |
)
|
| 190 |
|
| 191 |
input_image.clear(
|
| 192 |
fn=clear_outputs,
|
| 193 |
inputs=[],
|
| 194 |
+
outputs=[label_output]#, generated_image, wiki_output, status_output] # β UPDATED
|
| 195 |
)
|
| 196 |
|
| 197 |
|