Spaces:
Runtime error
Runtime error
Update stri.py
Browse files
stri.py
CHANGED
@@ -72,13 +72,15 @@ if st.button('Сгенерировать'):
|
|
72 |
|
73 |
indices = np.argsort(cosine_similarities)[::-1] # Сортировка по убыванию
|
74 |
|
75 |
-
num_books_per_page = st.
|
76 |
|
77 |
for i in indices[:num_books_per_page]:
|
78 |
-
cols = st.columns(
|
79 |
-
cols[0].image(image_url[i], use_column_width=True)
|
80 |
cols[1].write("## " + books['title'][i])
|
81 |
cols[1].markdown("**Автор:** " + books['author'][i])
|
82 |
-
cols[1].markdown("**Аннотация:** " + books['annotation'][i]
|
83 |
-
|
|
|
|
|
|
|
84 |
cols[1].write("---")
|
|
|
72 |
|
73 |
indices = np.argsort(cosine_similarities)[::-1] # Сортировка по убыванию
|
74 |
|
75 |
+
num_books_per_page = st.selectbox("Количество книг на странице:", [3, 5, 10], index=0)
|
76 |
|
77 |
for i in indices[:num_books_per_page]:
|
78 |
+
cols = st.columns(2) # Создание двух столбцов для размещения информации и изображения
|
|
|
79 |
cols[1].write("## " + books['title'][i])
|
80 |
cols[1].markdown("**Автор:** " + books['author'][i])
|
81 |
+
cols[1].markdown("**Аннотация:** " + books['annotation'][i])
|
82 |
+
image_url = books['image_url'][i]
|
83 |
+
response = requests.get(image_url)
|
84 |
+
image = Image.open(BytesIO(response.content))
|
85 |
+
cols[0].image(image)
|
86 |
cols[1].write("---")
|