Spaces:
Running
Running
poemsforaphrodite
commited on
Commit
•
fb7f409
1
Parent(s):
b4a2f4a
Update app.py
Browse files
app.py
CHANGED
@@ -578,7 +578,12 @@ def show_paginated_dataframe(report, rows_per_page=20):
|
|
578 |
report['relevancy_score'] = report['relevancy_score'].apply(format_relevancy_score)
|
579 |
|
580 |
def truncate_url(url, max_length=30):
|
581 |
-
|
|
|
|
|
|
|
|
|
|
|
582 |
|
583 |
def make_clickable(url):
|
584 |
truncated_url = truncate_url(url)
|
|
|
578 |
report['relevancy_score'] = report['relevancy_score'].apply(format_relevancy_score)
|
579 |
|
580 |
def truncate_url(url, max_length=30):
|
581 |
+
parsed_url = urllib.parse.urlparse(url)
|
582 |
+
base_url = f"{parsed_url.scheme}://{parsed_url.netloc}"
|
583 |
+
path = parsed_url.path
|
584 |
+
if len(base_url) + len(path) > max_length:
|
585 |
+
return base_url + path[:max_length - len(base_url) - 3] + '...'
|
586 |
+
return base_url + path
|
587 |
|
588 |
def make_clickable(url):
|
589 |
truncated_url = truncate_url(url)
|