This Streamlit app allows users to upload images and ask questions about them. The app uses a generative AI model to generate responses to the questions. Each session's history of questions and answers is stored in a text file named after the uploaded image, allowing for easy review and record-keeping.
- Image Upload: Users can upload images in JPG or PNG format to ask questions about.
- Q&A Interface: After uploading an image, users can input questions, and the app provides AI-generated answers based on the image and question context.
- History Tracking: Each question and its corresponding answer are stored in a session-specific history, which is displayed below the input area.
- Persistent Records: The app saves a history of all questions and answers for each image in a text file named after the uploaded image, facilitating easy access to past interactions.
To run this app locally, you will need Python and Streamlit installed, along with a few other dependencies.
-
Clone this repository to your local machine.
-
Navigate to the cloned directory.
-
Install the required Python packages:
pip install -r requirements.txt
-
Run the Streamlit app:
streamlit run app.py
- Start the App: Launch the app using the Streamlit command mentioned above.
- Upload an Image: Use the "Choose an image..." button to upload a JPG or PNG image.
- Ask a Question: Enter your question about the uploaded image in the "Input Prompt:" text input field.
- View the Answer: Press the "Ask" button to receive an AI-generated answer to your question.
- Review History: The "History" section below the "Ask" button displays all the questions asked and answers received for the current image.
- Access Saved Histories: The app saves each session's Q&A history in a
.txt
file named after the uploaded image, which can be found in the app's running directory.
- Streamlit
- Google Generative AI (or your choice of AI model API)
- Python-dotenv
- PIL (Python Imaging Library)
Before running the app, make sure to set up your environment variables:
-
Create a
.env
file in the root directory of your project. -
Add your Google API Key (or relevant API Key for the AI model you are using) to the
.env
file:GOOGLE_API_KEY=your_api_key_here
-
The app will read this key to authenticate requests to the AI service.
Contributions to improve the app are welcome. Please follow the standard fork-clone-branch-pull request workflow.
gmail - [email protected] linkedin - www.linkedin.com/in/navneetrajsingh