Skip to content

Commit

Permalink
Started gradio app
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchenyang committed Jul 28, 2023
1 parent 8281c1b commit dc2c9c0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ upload:
python -m twine upload --repository pypi dist/*

install-local:
python -m pip install -e .[dev,test]
python -m pip install -e .[dev,test,webapp]
28 changes: 28 additions & 0 deletions gradio/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import gradio as gr
import numpy as np
import cv2
from multifocal_stitching import candidate_stitches, stitch, merge

def stitch_interface(img1, img2):
#use_wins, workers, peak_cutoff_std,
#peaks_dist_threshold, filter_radii, min_overlap,
#early_term_thresh):
res = stitch(*[cv2.cvtColor(np.array(im), cv2.COLOR_RGB2GRAY) for im in (img1, img2)])
dx, dy = res.coord
return merge(img1, img2, dx, dy, resize_factor=8)

demo = gr.Interface(fn=stitch_interface, inputs=[
gr.Image(type='pil'), gr.Image(type='pil')
], outputs=[
gr.Gallery()
], examples=[
["tests/imgs/high_freq_features_1_small.jpg",
"tests/imgs/high_freq_features_2_small.jpg", ]
])






demo.launch()
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ dependencies = [
[project.optional-dependencies] # Optional
dev = ["build", "twine"]
test = ["pytest", "pytest-cov"]
webapp = ["gradio", "matplotlib"]

[build-system]
requires = ["setuptools>=62"]
Expand Down

0 comments on commit dc2c9c0

Please sign in to comment.