-Fixed path for images -Added border around images
This commit is contained in:
parent
79b73713e3
commit
6ee1428b64
File diff suppressed because one or more lines are too long
@ -7,7 +7,7 @@ from transformers import BertTokenizer, BertModel
|
||||
from sentence_transformers import SentenceTransformer
|
||||
from model.recommend_movies import recommend_movies, load_embeddings
|
||||
|
||||
app = Flask(__name__)
|
||||
app = Flask(__name__,static_folder="assets")
|
||||
|
||||
data_path = "../data/preprocessed_data.csv"
|
||||
bert_embeddings_path = "../data/bert_embeddings.pkl"
|
||||
|
@ -14,7 +14,7 @@
|
||||
{% for recommendation in recommendations %}
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex align-items-start">
|
||||
<img src="{{ recommendation.img_path }}" alt="{{ recommendation.title }}" class="img-fluid me-3" style="max-width: 150px;">
|
||||
<img src="{{ recommendation.img_path }}" alt="{{ recommendation.title }}" class="img-fluid me-3" style="max-width: 150px; margin-top: 50px; border: 2px solid black;">
|
||||
<div>
|
||||
<h5><strong>{{ recommendation.title }}</strong></h5>
|
||||
<p><strong>Release Date:</strong> {{ recommendation.release_date }}</p>
|
||||
|
@ -9,7 +9,7 @@ import config
|
||||
def get_image(url,id):
|
||||
time.sleep(5)
|
||||
headers = config.headers
|
||||
default_img_path="app/assets/static/default.jpg"
|
||||
default_img_path="assets/static/default.jpg"
|
||||
try:
|
||||
# Get main page
|
||||
response=requests.get(url,headers=headers)
|
||||
@ -22,9 +22,9 @@ def get_image(url,id):
|
||||
if(response.status_code!=200):
|
||||
return default_img_path
|
||||
# Save image
|
||||
with open(f"app/assets/static/{id}.jpg", 'wb') as f:
|
||||
with open(f"assets/static/{id}.jpg", 'wb') as f:
|
||||
f.write(response.content)
|
||||
return f"app/assets/static/{id}.jpg"
|
||||
return f"assets/static/{id}.jpg"
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return default_img_path
|
||||
|
Loading…
Reference in New Issue
Block a user