-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from archit-spec/dev
Dev
- Loading branch information
Showing
11 changed files
with
577 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
FROM python:3.11 | ||
FROM python:3.8.10-slim | ||
|
||
WORKDIR /app | ||
COPY requirements.txt requirements.txt | ||
RUN pip install -r requirements.txt | ||
|
||
COPY poetry.lock pyproject.toml ./ | ||
|
||
RUN pip install poetry && poetry config virtualenvs.create false | ||
|
||
RUN /root/.cargo/bin/uv pip install --no-cache -r requirements.txt | ||
|
||
COPY . . | ||
|
||
EXPOSE 5001 | ||
CMD ["python", "app.py"] | ||
|
||
# Command to run the application (assuming it's a Flask app) | ||
CMD ["streamlit", "run","main.py"] # Replace with your application's entry point if different | ||
# Alternative command for uvicorn (if your application uses it) | ||
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "5001"] | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import streamlit as st | ||
import os | ||
from PIL import Image | ||
from src.captioning import ImageCaptioning | ||
|
||
def main(): | ||
"""Main function of the Streamlit application.""" | ||
st.title("Image Explorer") | ||
|
||
# Get directory path from user input or set default | ||
default_dir = os.getcwd() # Use current working directory as default | ||
user_dir = st.text_input("Enter directory path:", default_dir) | ||
if user_dir: | ||
dir_path = user_dir | ||
else: | ||
dir_path = default_dir | ||
|
||
# Check if directory exists | ||
if not os.path.exists(dir_path): | ||
st.error(f"Directory '{dir_path}' does not exist") | ||
return | ||
|
||
# Create an instance of ImageCaptioning and generate the index | ||
image_captioning = ImageCaptioning() | ||
image_dict = image_captioning.make_index(dir_path) | ||
|
||
# Add search bar | ||
search_term = st.text_input("Search images by description:", "") | ||
|
||
# Filter images based on search term | ||
filtered_images = [ | ||
(image_path, descriptions) | ||
for image_path, descriptions in image_dict.items() | ||
if any(search_term.lower() in description.lower() for description in descriptions) | ||
] | ||
|
||
# Define CSS class (assuming you have a style.css file linked) | ||
st.markdown(f"<link rel='stylesheet' href='path/to/your/style.css'>", unsafe_allow_html=True) | ||
|
||
# Display images with descriptions and file paths | ||
for image_path, descriptions in filtered_images: | ||
st.image(Image.open(image_path)) | ||
st.markdown(f"<p class='caption-center'>Image Path: {image_path}</p>", unsafe_allow_html=True) | ||
for description in descriptions: | ||
st.markdown(f"<p class='caption-center'>Description: {description}</p>", unsafe_allow_html=True) | ||
|
||
if __name__ == "__main__": | ||
main() | ||
|
Oops, something went wrong.