• Stars
    star
    219
  • Rank 181,133 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 3 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Image comparison slider component for Streamlit

Streamlit Image Comparison Component

pypi version total downloads HuggingFace Spaces fcakyon twitter

A simple Streamlit Component to compare images with a slider in Streamlit apps using Knightlab's JuxtaposeJS. It accepts images in any format and makes it possible to set all parameters of the JS component via Python. Live demo at Huggingface Spaces

Installation

  • Install via pip:
pip install streamlit
pip install streamlit-image-comparison

Example

# Streamlit Image-Comparison Component Example

import streamlit as st
from streamlit_image_comparison import image_comparison

# set page config
st.set_page_config(page_title="Image-Comparison Example", layout="centered")

# render image-comparison
image_comparison(
    img1="image1.jpg",
    img2="image2.jpg",
)

Supported Image Formats

# image path
image = "image.jpg"

# image url
image = "https://some-url.com/image.jpg"

# pil image
from PIL import Image
image = Image.open("image.jpg")

# opencv image
import cv2
image = cv2.cvtColor(cv2.imread("image.jpg"), cv2.COLOR_BGR2RGB)

# render image-comparison
image_comparison(
    img1=image,
    img2=image,
)

Customization

image_comparison(
    img1="image1.jpg",
    img2="image2.jpg",
    label1="text1",
    label2="text1",
    width=700,
    starting_position=50,
    show_labels=True,
    make_responsive=True,
    in_memory=True,
)

Improvements

What is the difference between this repo and robmarkcole's?

  • This is a pypi installable package
  • This does not require the images to be saved under site-packages/streamlit/static/
  • This accepts any type of image as input (doesn't have to be present in local)
  • This can utilize all parameters of the JS component

References

More Repositories

1

content-moderation-deep-learning

Deep learning based content moderation from text, audio, video & image input modalities.
302
star
2

yolov5-pip

Packaged version of ultralytics/yolov5 + many extra features
Python
291
star
3

craft-text-detector

Packaged, Pytorch-based, easy to use, cross-platform version of the CRAFT text detector
Python
252
star
4

small-object-detection-benchmark

icip2022 paper: sahi benchmark on visdrone and xview datasets using fcos, vfnet and tood detectors
Python
157
star
5

video-transformers

Easiest way of fine-tuning HuggingFace video classification models
Python
131
star
6

pywhisper

openai/whisper + extra features
Python
89
star
7

balanced-loss

Easy to use class balanced cross entropy and focal loss implementation for Pytorch
Python
87
star
8

midv500

Download and convert MIDV-500 annotations to COCO instance segmentation format
Python
83
star
9

ultralyticsplus

Huggingface utilities for Ultralytics/YOLOv8
Python
77
star
10

flask-redis-docker

A minimal template for dockerized flask app with redis task queue
Python
58
star
11

instafake-dataset

Dataset for Intagram Fake and Automated Account Detection
Python
49
star
12

face-recognition-app-tutorial

A face recognition web app powered by Facenet model using Flask, OpenCV, Heroku
HTML
35
star
13

mmdetection-object-tracker

A lightweight script for performing Kalman filter based object tracking using MMDetection models.
Python
22
star
14

augmented-maskrcnn

Object detection and instance segmentation on MaskRCNN with torchvision, albumentations, tensorboard and cocoapi. Supports custom coco datasets with positive/negative samples.
Python
19
star
15

confplot

Confusion Matrix in Python: Plot a pretty confusion matrix (like Matlab) in python using seaborn and matplotlib
Python
11
star
16

face-detection-app-tutorial

A face detection web app powered by SSD face detecctor using Flask, OpenCV, Heroku
Jupyter Notebook
7
star
17

ieee-fraud-detection

IEEE Fraud Detection with XGBoost and CatBoost
Jupyter Notebook
5
star
18

yolov5-to-supervisely

Use your yolov5 predictions as supervisely annotations
Python
4
star
19

cifar100-resnet

ResNet Implementation for CIFAR100 in Pytorch
Jupyter Notebook
4
star
20

turkish-qa-datasets

creating this repo to host some turkish nlp datasets
3
star
21

earth2-scraper

Up-to-date earth2.io data
Python
3
star
22

musicalpy

Easiest way of combining a music and a video
Python
2
star
23

insta-assist

Personal Instagram Tools
Python
2
star
24

fcakyon

2
star
25

deprem-uydu-bina-tespiti

Instance segmentation ve change detection ile uydu goruntusunden bina tespiti
Python
2
star
26

gpt2-shakespeare

A tutorial on GPT2 language model training with texts from Shakespeare
Jupyter Notebook
1
star
27

glassdoor-review-textgenrnn

Train char-rnn with Glassdoor reviews and generate sentences
Python
1
star
28

DiyarMobileFood

C#
1
star
29

public-files

personal repo for hosting large files
1
star