bradley6597
commited on
Commit
•
9da3be7
1
Parent(s):
df4c3d4
Added illustration filenames
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ import uvicorn
|
|
10 |
from starlette.middleware.sessions import SessionMiddleware
|
11 |
import fastapi
|
12 |
from datetime import datetime
|
|
|
13 |
|
14 |
login(token = os.environ['HUB_TOKEN'])
|
15 |
|
@@ -32,10 +33,10 @@ ill_links = df.copy()
|
|
32 |
ill_links = ill_links[ill_links['Description'] != 'Moved'].copy()
|
33 |
ill_links['code'] = ill_links['link'].str.replace("https://drive.google.com/file/d/", "", regex = False)
|
34 |
ill_links['code'] = ill_links['code'].str.replace("/view?usp=drivesdk", "", regex = False)
|
|
|
35 |
# ill_links['image_code'] = 'https://lh3.google.com/u/0/d/' + ill_links['code'] + '=k'
|
36 |
ill_links['image_code'] = 'https://lh3.google.com/u/0/d/' + ill_links['code'] + '=w320-h304'
|
37 |
-
ill_links['image_code'] = '<center><a href="' + ill_links['link'] + '" target="_blank" onclick="magicFunc(\'' + ill_links['code'] + '\')"><img src="' + ill_links['image_code'] + '" style="max-height:400px; max-width:200px"
|
38 |
-
ill_links['filename'] = ill_links['file'].str.replace(".*\\/", "", regex = True)
|
39 |
ill_links['shared_drive'] = ill_links['file'].str.replace("/content/drive/Shareddrives/", "", regex = False)
|
40 |
ill_links['shared_drive'] = ill_links['shared_drive'].str.replace("(.*?)\\/.*", "\\1", regex = True)
|
41 |
ill_links['Description'] = ill_links['Description'].str.replace("No Description", "", regex = False)
|
@@ -61,6 +62,7 @@ ill_check_lst = []
|
|
61 |
for i in range(0, 5):
|
62 |
tmp_links = ill_links['url'].iloc[0].replace("/u/0/", f"/u/{i}/")
|
63 |
tmp_links = tmp_links.replace('max-width:200px', 'max-width:25%')
|
|
|
64 |
tmp_links = tmp_links.replace("<center>", "")
|
65 |
tmp_links = tmp_links.replace("</center>", "")
|
66 |
tmp_links = f'<p>{i}</p>' + tmp_links
|
|
|
10 |
from starlette.middleware.sessions import SessionMiddleware
|
11 |
import fastapi
|
12 |
from datetime import datetime
|
13 |
+
import re
|
14 |
|
15 |
login(token = os.environ['HUB_TOKEN'])
|
16 |
|
|
|
33 |
ill_links = ill_links[ill_links['Description'] != 'Moved'].copy()
|
34 |
ill_links['code'] = ill_links['link'].str.replace("https://drive.google.com/file/d/", "", regex = False)
|
35 |
ill_links['code'] = ill_links['code'].str.replace("/view?usp=drivesdk", "", regex = False)
|
36 |
+
ill_links['filename'] = ill_links['file'].str.replace(".*\\/", "", regex = True)
|
37 |
# ill_links['image_code'] = 'https://lh3.google.com/u/0/d/' + ill_links['code'] + '=k'
|
38 |
ill_links['image_code'] = 'https://lh3.google.com/u/0/d/' + ill_links['code'] + '=w320-h304'
|
39 |
+
ill_links['image_code'] = '<center><a href="' + ill_links['link'] + '" target="_blank" onclick="magicFunc(\'' + ill_links['code'] + '\')"><img src="' + ill_links['image_code'] + '" style="max-height:400px; max-width:200px"> ' + ill_links['filename'] + '</a></center>'
|
|
|
40 |
ill_links['shared_drive'] = ill_links['file'].str.replace("/content/drive/Shareddrives/", "", regex = False)
|
41 |
ill_links['shared_drive'] = ill_links['shared_drive'].str.replace("(.*?)\\/.*", "\\1", regex = True)
|
42 |
ill_links['Description'] = ill_links['Description'].str.replace("No Description", "", regex = False)
|
|
|
62 |
for i in range(0, 5):
|
63 |
tmp_links = ill_links['url'].iloc[0].replace("/u/0/", f"/u/{i}/")
|
64 |
tmp_links = tmp_links.replace('max-width:200px', 'max-width:25%')
|
65 |
+
tmp_links = re.sub("(.*)>.*?<\\/a>", "\\1></a>", tmp_links)
|
66 |
tmp_links = tmp_links.replace("<center>", "")
|
67 |
tmp_links = tmp_links.replace("</center>", "")
|
68 |
tmp_links = f'<p>{i}</p>' + tmp_links
|