Spaces:
Runtime error
Runtime error
末尾に,があると上手く動かないのを修正
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ i2n, i2c, n2i, entries = load_database()
|
|
40 |
def greet(query):
|
41 |
results = []
|
42 |
errors = []
|
43 |
-
target_tags = [x.strip().replace(" ", "_") for x in query.split(",")]
|
44 |
target_ids = set()
|
45 |
for tag_name in target_tags:
|
46 |
try:
|
@@ -54,7 +54,8 @@ def greet(query):
|
|
54 |
rates = []
|
55 |
matched_entries = list(filter(lambda entry: target_ids.issubset(entry), entries))
|
56 |
print(len(matched_entries))
|
57 |
-
|
|
|
58 |
results.append(['Too many {} entries have been matched. <br>Please change or increase tags for reduce matches.'.format(len(matched_entries)), -1])
|
59 |
else:
|
60 |
results.append(['{} entries have been matched.'.format(len(matched_entries)), -1])
|
|
|
40 |
def greet(query):
|
41 |
results = []
|
42 |
errors = []
|
43 |
+
target_tags = [x.strip().replace(" ", "_") for x in query.split(",") if x]
|
44 |
target_ids = set()
|
45 |
for tag_name in target_tags:
|
46 |
try:
|
|
|
54 |
rates = []
|
55 |
matched_entries = list(filter(lambda entry: target_ids.issubset(entry), entries))
|
56 |
print(len(matched_entries))
|
57 |
+
MAX_MATCHED_ENTRIES = 5000
|
58 |
+
if len(matched_entries) > MAX_MATCHED_ENTRIES:
|
59 |
results.append(['Too many {} entries have been matched. <br>Please change or increase tags for reduce matches.'.format(len(matched_entries)), -1])
|
60 |
else:
|
61 |
results.append(['{} entries have been matched.'.format(len(matched_entries)), -1])
|