from turtle import ht
import requests
import gradio as gr
def make_request(img_url, min_score):
headers = {
'accept': 'application/json',
'public-key': 'xxx',
}
params = {
'url': img_url,
'min_score': min_score,
}
response = requests.get('https://api-similarity-zx53qegsda-as.a.run.app/v1/similarity/', params=params, headers=headers)
result = response.json()
return result
def show_result(image_url, min_score=0.7):
result = make_request(image_url, min_score)
html = f'Original Image
'
if len(result['result']) == 0:
html += '
{raw["similarity"] * 100}% Title: {detail["title"]} User : {detail["user"]["name"]} |
'''
if i > 0 and i%2 == 1:
html += '