MARI-posa commited on
Commit
19a6530
·
1 Parent(s): c1b3993

Update stri.py

Browse files
Files changed (1) hide show
  1. stri.py +6 -1
stri.py CHANGED
@@ -6,6 +6,8 @@ from PIL import Image
6
  from transformers import AutoTokenizer, AutoModel
7
  import re
8
  import pickle
 
 
9
 
10
  st.title("Книжные рекомендации")
11
 
@@ -76,5 +78,8 @@ if st.button('Сгенерировать'):
76
  st.write("## " + books['title'][i])
77
  st.write("**Автор:**", books['author'][i])
78
  st.write("**Аннотация:**", books['annotation'][i])
79
- st.image(Image.open(books['image_url'][i]))
 
 
 
80
  st.write("---")
 
6
  from transformers import AutoTokenizer, AutoModel
7
  import re
8
  import pickle
9
+ import requests
10
+ from io import BytesIO
11
 
12
  st.title("Книжные рекомендации")
13
 
 
78
  st.write("## " + books['title'][i])
79
  st.write("**Автор:**", books['author'][i])
80
  st.write("**Аннотация:**", books['annotation'][i])
81
+ image_url = books['image_url'][i]
82
+ response = requests.get(image_url)
83
+ image = Image.open(BytesIO(response.content))
84
+ st.image(image)
85
  st.write("---")