Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
import similarSearch
|
| 4 |
+
|
| 5 |
+
# Function to find similar image IDs for a newly updated image
|
| 6 |
+
def find_similar_images(new_image):
|
| 7 |
+
# Placeholder for your code to find similar image IDs based on the new_image
|
| 8 |
+
similar_ids = similarSearch.predict(new_image) # Replace with the actual logic for finding similar IDs
|
| 9 |
+
print(similar_ids)
|
| 10 |
+
return similar_ids
|
| 11 |
+
|
| 12 |
+
# Define Gradio interface
|
| 13 |
+
iface = gr.Interface(
|
| 14 |
+
fn=find_similar_images,
|
| 15 |
+
inputs=gr.inputs.Image(label="Upload Image"),
|
| 16 |
+
outputs=gr.outputs.Textbox(label="Similar Image IDs"),
|
| 17 |
+
title="Image Similarity Finder",
|
| 18 |
+
description="Upload an image to find similar image IDs in the database."
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# Launch the Gradio interface
|
| 22 |
+
iface.launch()
|