Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,7 +42,7 @@ def levenshtein_distance(s1, s2):
|
|
| 42 |
|
| 43 |
return previous_row[-1]
|
| 44 |
|
| 45 |
-
def string_similarity_index(original_text, comparison_text, threshold=0.
|
| 46 |
"""
|
| 47 |
Calculate the similarity index between two strings based on Levenshtein distance
|
| 48 |
and compare it to a threshold.
|
|
@@ -80,7 +80,7 @@ def generate_ai_title():
|
|
| 80 |
title = title.strip() # Remove any extra whitespace characters like newlines
|
| 81 |
if string_similarity_index(generated_title, title):
|
| 82 |
is_unique = False
|
| 83 |
-
print(f"Regenerating!
|
| 84 |
break
|
| 85 |
|
| 86 |
if is_unique:
|
|
|
|
| 42 |
|
| 43 |
return previous_row[-1]
|
| 44 |
|
| 45 |
+
def string_similarity_index(original_text, comparison_text, threshold=0.65):
|
| 46 |
"""
|
| 47 |
Calculate the similarity index between two strings based on Levenshtein distance
|
| 48 |
and compare it to a threshold.
|
|
|
|
| 80 |
title = title.strip() # Remove any extra whitespace characters like newlines
|
| 81 |
if string_similarity_index(generated_title, title):
|
| 82 |
is_unique = False
|
| 83 |
+
print(f"Regenerating! Generated title was: \""{generated_title}\", and the real title was \"{title}\")
|
| 84 |
break
|
| 85 |
|
| 86 |
if is_unique:
|