Skip to content

Commit

Permalink
Título: #7 Solucionado el problema en la función N_mas_parecidas.
Browse files Browse the repository at this point in the history
  • Loading branch information
albertjcuac committed Jan 9, 2023
1 parent c88a4bf commit 6efb01a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Binary file modified elevate/lynx/__pycache__/views.cpython-39.pyc
Binary file not shown.
Binary file added elevate/lynx/static/3818.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions elevate/lynx/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def N_mas_parecidas(imagen,n,imagenes):
candidata = Image.open('lynx'+im.get('url'))
vec2 = img2vec.get_vec(candidata.convert('RGB'), tensor=True).reshape(512)
cos_sim = cos(vec1.unsqueeze(0),vec2.unsqueeze(0))
if(cos_sim!=1): #no quiero devolver la propia imagen cono recomendación
if(cos_sim<1): #no quiero devolver la propia imagen cono recomendación
dic[im.get('name')]=cos_sim
similitudes.append(cos_sim)
n_mayor_similitud=sorted(list(set(similitudes)), reverse=True)[:n]
Expand Down Expand Up @@ -210,9 +210,9 @@ def images_view(request):
'link': '/images/59018.jpg',
},
{
'url': '/static/10054.jpg',
'url': '/static/3818.jpg',
'name': 'Imagen 6',
'link': '/images/10054.jpg',
'link': '/images/3818.jpg',
},


Expand Down

0 comments on commit 6efb01a

Please sign in to comment.