Skip to content

Commit

Permalink
Merge pull request #1 from archit-spec/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
archit-spec authored Mar 6, 2024
2 parents 1a20dde + c91e169 commit e826871
Show file tree
Hide file tree
Showing 11 changed files with 577 additions and 84 deletions.
20 changes: 16 additions & 4 deletions Dockerfile
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"]
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Deeplearning based filebrowser (WIP):

## image captioning demo
![demo for captioning](./demo.mp4)
## filebrowser demo
![demo](https://youtu.be/CIXq6xz7tHc)

- aim is to provide a better search in filebrowsers when the filebrowsere names are cryptic and it is hard to find an image or a document based on the standard search
## todo
- make ui
- make easily deoployable with docker and add onnx runtime or optimuim
- add support for pdfs, and videos using sentence transformer embeddings and video captioning models
- [x] Make UI
- [ ] Make easily deployable with Docker and add ONNX Runtime or Optimuim
- [ ] Add support for PDFs and videos using Sentence Transformer embeddings and video captioning models
- [ ] Optimize using `joblib` cache


## to run. do:
Expand Down
Binary file removed demo.mp4
Binary file not shown.
Binary file removed filebrowser.png
Binary file not shown.
60 changes: 0 additions & 60 deletions interface.py

This file was deleted.

49 changes: 49 additions & 0 deletions main.py
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()

Loading

0 comments on commit e826871

Please sign in to comment.