KB-VQA-E / my_model /tabs /readme.md
m7mdal7aj's picture
Create readme.md
643df5e verified
|
raw
history blame
3.54 kB

Directory Overview: This directory contains all the atreamlit application pages:

################################################################

  1. results.py The results.py module manages the interactive Streamlit demo for visualizing model evaluation results and analysis. It provides an interface for users to explore different aspects of model performance and evaluation samples.

Functions:

run_demo() -> None The run_demo function sets up an interactive Streamlit interface that allows users to select and visualize various aspects of model evaluation results and analysis. Users can choose between evaluation results & analysis or view random evaluation samples.

Notes

Ensure the necessary dependencies are installed and properly configured. The run_demo function relies on the ResultDemonstrator class to generate plots and display results.

################################################################

  1. run_inference.py

The run_inference.py is responsible for the running inference and utilizing the fine-tuned models page. It manages the user interface and interactions for a Streamlit-based Knowledge-Based Visual Question Answering (KBVQA) application. This module handles image uploads, displays sample images, and facilitates the question-answering process using the KBVQA model.

Class: InferenceRunner

Overview

The InferenceRunner class provides functionalities to manage the user interface for KBVQA, enabling users to upload images, select sample images, and ask questions about the images.

Methods

  • __init__() -> None: Initializes the InferenceRunner instance, setting up the necessary state.
  • answer_question(caption: str, detected_objects_str: str, question: str) -> Tuple[str, int]: Generates an answer to a user's question based on the image's caption and detected objects.
  • display_sample_images() -> None: Displays sample images as clickable thumbnails for the user to select.
  • handle_image_upload() -> None: Provides an image uploader widget for the user to upload their own images.
  • display_image_and_analysis(image_key: str, image_data: Dict, nested_col21: DeltaGenerator, nested_col22: DeltaGenerator) -> None: Displays the uploaded or selected image and provides an option to analyze the image.
  • handle_analysis_button(image_key: str, image_data: Dict, nested_col22: DeltaGenerator) -> None: Provides an 'Analyze Image' button and processes the image analysis upon click.
  • handle_question_answering(image_key: str, image_data: Dict, nested_col22: DeltaGenerator) -> None: Manages the question-answering interface for each image.
  • display_question_answering_interface(image_key: str, image_data: Dict, nested_col22: DeltaGenerator) -> None: Displays the interface for question answering, including sample questions and a custom question input.
  • process_question(image_key: str, question: str, image_data: Dict, nested_col22: DeltaGenerator) -> None: Processes the user's question, generates an answer, and updates the question-answer history.
  • image_qa_app() -> None: Main application interface for image-based question answering.
  • run_inference() -> None: Sets up widgets and manages the inference process, including model loading and reloading, based on user interactions.

Notes

  • Ensure the necessary dependencies are installed and properly configured.
  • The InferenceRunner class relies on the KBVQA model to generate answers to questions based on image analysis.

################################################################