vam
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import random
|
|
4 |
import matplotlib.pyplot as plt
|
5 |
import matplotlib.image as mpimg
|
6 |
from embedding import model, docs_list, doc_embeddings, embedded_dict
|
|
|
7 |
import openai
|
8 |
from openai import OpenAI
|
9 |
import os
|
@@ -50,8 +51,8 @@ def create_meme(prompt):
|
|
50 |
closest_text_idx = np.argmax(similarities)
|
51 |
|
52 |
# Tải ảnh meme tương ứng
|
53 |
-
img_path =
|
54 |
-
img = mpimg.imread(img_path)
|
55 |
|
56 |
# Tạo khoảng trắng để hiển thị caption
|
57 |
white_space_height = 100
|
|
|
4 |
import matplotlib.pyplot as plt
|
5 |
import matplotlib.image as mpimg
|
6 |
from embedding import model, docs_list, doc_embeddings, embedded_dict
|
7 |
+
from preprocess import meme_attribute, meme_filename, meme_list
|
8 |
import openai
|
9 |
from openai import OpenAI
|
10 |
import os
|
|
|
51 |
closest_text_idx = np.argmax(similarities)
|
52 |
|
53 |
# Tải ảnh meme tương ứng
|
54 |
+
img_path = meme_filename[closest_text_idx]
|
55 |
+
img = mpimg.imread(f'/kaggle/input/memedata/{img_path}')
|
56 |
|
57 |
# Tạo khoảng trắng để hiển thị caption
|
58 |
white_space_height = 100
|