Commit
·
d0763c6
1
Parent(s):
91bf496
Add lru_cache decorator to improve performance
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ from pathlib import Path
|
|
8 |
from huggingface_hub import CommitScheduler
|
9 |
from dotenv import load_dotenv
|
10 |
import os
|
|
|
11 |
|
12 |
load_dotenv()
|
13 |
|
@@ -112,6 +113,7 @@ def post_comment(
|
|
112 |
return False
|
113 |
|
114 |
|
|
|
115 |
def is_comment_from_librarian_bot(html: str) -> bool:
|
116 |
"""
|
117 |
Checks if the given HTML contains a comment from the librarian-bot.
|
@@ -198,7 +200,10 @@ examples = [
|
|
198 |
]
|
199 |
interface = gr.Interface(
|
200 |
return_recommendations,
|
201 |
-
[
|
|
|
|
|
|
|
202 |
gr.Markdown(),
|
203 |
examples=examples,
|
204 |
title=title,
|
|
|
8 |
from huggingface_hub import CommitScheduler
|
9 |
from dotenv import load_dotenv
|
10 |
import os
|
11 |
+
from functools import lru_cache
|
12 |
|
13 |
load_dotenv()
|
14 |
|
|
|
113 |
return False
|
114 |
|
115 |
|
116 |
+
@lru_cache(maxsize=500)
|
117 |
def is_comment_from_librarian_bot(html: str) -> bool:
|
118 |
"""
|
119 |
Checks if the given HTML contains a comment from the librarian-bot.
|
|
|
200 |
]
|
201 |
interface = gr.Interface(
|
202 |
return_recommendations,
|
203 |
+
[
|
204 |
+
gr.Textbox(lines=1),
|
205 |
+
gr.Checkbox(label="Post recommendations to Paper page?", default=False),
|
206 |
+
],
|
207 |
gr.Markdown(),
|
208 |
examples=examples,
|
209 |
title=title,
|