Spaces:
Runtime error
Runtime error
Update pages/book.py
Browse files- pages/book.py +14 -10
pages/book.py
CHANGED
|
@@ -61,13 +61,17 @@ if generate_button:
|
|
| 61 |
indices = np.argsort(cosine_similarities)[::-1] # Сортировка по убыванию
|
| 62 |
|
| 63 |
for i in indices[:num_books_per_page]:
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
cols
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
indices = np.argsort(cosine_similarities)[::-1] # Сортировка по убыванию
|
| 62 |
|
| 63 |
for i in indices[:num_books_per_page]:
|
| 64 |
+
col1, col2, col3 = st.columns([2,5,2])
|
| 65 |
+
|
| 66 |
+
with col2:
|
| 67 |
+
#cols = st.columns(2) # Создание двух столбцов для размещения информации и изображения
|
| 68 |
+
st.write("## " + books['title'][i])
|
| 69 |
+
st.markdown("**Автор:** " + books['author'][i])
|
| 70 |
+
st.markdown("**Аннотация:** " + books['annotation'][i])
|
| 71 |
+
image_url = books['image_url'][i]
|
| 72 |
+
response = requests.get(image_url)
|
| 73 |
+
image = Image.open(BytesIO(response.content))
|
| 74 |
+
with col1:
|
| 75 |
+
st.image(image)
|
| 76 |
+
st.write(cosine_similarities[i])
|
| 77 |
+
st.write("---")
|