Spaces:
Runtime error
Runtime error
File size: 810 Bytes
022cc94 54b829f 5b6298c ccdb9f2 54b829f 2da369d 022cc94 f9f615c 022cc94 b92b754 022cc94 5b6298c eb894e3 54b829f eb894e3 54b829f f9f615c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import gradio
import pandas as pd
from annoy import AnnoyIndex
from deepface import DeepFace
import gdown
from similarity_finder.get_similar_images import get_similar_images
def my_inference_function(image_path, age, gender, race):
global df
r = get_similar_images(df, image_path, int(age), gender, race)
return r
gradio_interface = gradio.Interface(
fn = my_inference_function,
inputs = [gradio.Image(type="filepath"), gradio.Textbox(label="Age"), gradio.Textbox(label="Gender"), gradio.Textbox(label="Race")],
outputs = "text"
)
print("downloading dataset")
id = "1z6amrk21M-4N39OZLOsi4WWjAdBVSjh7"
gdown.download(id=id, output="final_dataframe.parquet.gzip", quiet=False)
print("loading dataframe")
df = pd.read_parquet("final_dataframe.parquet.gzip")
gradio_interface.launch(share=True)
|