Spaces:
Sleeping
Sleeping
Change 'selected_image' into a Gradio component
Browse filesSeems like Gradio's listeners are designed to output to other components, for the most part?
app.py
CHANGED
|
@@ -22,8 +22,6 @@ yolos_id = "hustvl/yolos-small-300"
|
|
| 22 |
yolos_processor: YolosImageProcessor = YolosImageProcessor.from_pretrained(yolos_id)
|
| 23 |
yolos_model: YolosForObjectDetection = YolosForObjectDetection.from_pretrained(yolos_id)
|
| 24 |
|
| 25 |
-
selected_image = 0
|
| 26 |
-
|
| 27 |
|
| 28 |
def answer_question(img, prompt):
|
| 29 |
"""
|
|
@@ -103,6 +101,7 @@ if __name__ == "__main__":
|
|
| 103 |
Final project for IAT 481 at Simon Fraser University, Spring 2024.
|
| 104 |
"""
|
| 105 |
)
|
|
|
|
| 106 |
|
| 107 |
# Referenced: https://github.com/gradio-app/gradio/issues/7726#issuecomment-2028051431
|
| 108 |
with gr.Tabs(selected='yolos') as tabs:
|
|
|
|
| 22 |
yolos_processor: YolosImageProcessor = YolosImageProcessor.from_pretrained(yolos_id)
|
| 23 |
yolos_model: YolosForObjectDetection = YolosForObjectDetection.from_pretrained(yolos_id)
|
| 24 |
|
|
|
|
|
|
|
| 25 |
|
| 26 |
def answer_question(img, prompt):
|
| 27 |
"""
|
|
|
|
| 101 |
Final project for IAT 481 at Simon Fraser University, Spring 2024.
|
| 102 |
"""
|
| 103 |
)
|
| 104 |
+
selected_image = gr.Number(visible=False)
|
| 105 |
|
| 106 |
# Referenced: https://github.com/gradio-app/gradio/issues/7726#issuecomment-2028051431
|
| 107 |
with gr.Tabs(selected='yolos') as tabs:
|