Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -141,24 +141,36 @@ class AnimeRecommender:
|
|
| 141 |
def NCF_Recommendation(self, a, b, c):
|
| 142 |
anime_list = [a, b, c]
|
| 143 |
anime_result = self.find_similar_animes_combined(anime_list, n=3)
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
# 파일 경로 설정
|
| 164 |
rating_path = 'data/rating_complete.csv'
|
|
@@ -198,4 +210,4 @@ with gr.Blocks() as app:
|
|
| 198 |
outputs=[output1, output2, img1, output3, output4, img2, output5, output6, img3]
|
| 199 |
)
|
| 200 |
|
| 201 |
-
app.launch(
|
|
|
|
| 141 |
def NCF_Recommendation(self, a, b, c):
|
| 142 |
anime_list = [a, b, c]
|
| 143 |
anime_result = self.find_similar_animes_combined(anime_list, n=3)
|
| 144 |
+
|
| 145 |
+
results = []
|
| 146 |
+
explains = []
|
| 147 |
+
images = []
|
| 148 |
+
|
| 149 |
+
for i in range(min(len(anime_result), 3)):
|
| 150 |
+
try:
|
| 151 |
+
result = anime_result.loc[anime_result.index[i], 'name']
|
| 152 |
+
explain = anime_result.loc[anime_result.index[i], 'sypnopsis']
|
| 153 |
+
url = self.get_anime_url(result)
|
| 154 |
+
image = self.extract_image_url(url)
|
| 155 |
+
|
| 156 |
+
results.append(result)
|
| 157 |
+
explains.append(explain)
|
| 158 |
+
images.append(image)
|
| 159 |
+
except Exception as e:
|
| 160 |
+
print(f"오류 발생: {e}")
|
| 161 |
+
break
|
| 162 |
+
|
| 163 |
+
# 부족한 부분을 빈 문자열로 채우기
|
| 164 |
+
while len(results) < 3:
|
| 165 |
+
results.append("")
|
| 166 |
+
explains.append("")
|
| 167 |
+
images.append("")
|
| 168 |
+
|
| 169 |
+
return (
|
| 170 |
+
results[0], explains[0], images[0],
|
| 171 |
+
results[1], explains[1], images[1],
|
| 172 |
+
results[2], explains[2], images[2]
|
| 173 |
+
)
|
| 174 |
|
| 175 |
# 파일 경로 설정
|
| 176 |
rating_path = 'data/rating_complete.csv'
|
|
|
|
| 210 |
outputs=[output1, output2, img1, output3, output4, img2, output5, output6, img3]
|
| 211 |
)
|
| 212 |
|
| 213 |
+
app.launch()
|