Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ import squarify
|
|
8 |
import numpy as np
|
9 |
import re
|
10 |
import urllib.request
|
|
|
11 |
|
12 |
st.set_page_config(
|
13 |
page_title="FATA4 Science",
|
@@ -65,7 +66,7 @@ if any([x in query for x in matches]):
|
|
65 |
# query = input ("Enter your keyword(s):")
|
66 |
if query:
|
67 |
bar = st.progress(0)
|
68 |
-
time.sleep(.
|
69 |
st.caption(f":LightSkyBlue[searching {num_abstracts} {database_name} PubMed abstracts] covering 1990-2022")
|
70 |
|
71 |
for i in range(10):
|
@@ -163,17 +164,55 @@ if query:
|
|
163 |
mime='text/csv')
|
164 |
|
165 |
if query:
|
|
|
|
|
166 |
search_keyword = {query}
|
167 |
html = urllib.request.urlopen(f"https://www.youtube.com/results?search_query={database_name}")
|
168 |
video_ids = re.findall(r"watch\?v=(\S{11})", html.read().decode())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
# st.video("https://www.youtube.com/watch?v=" + video_ids[0])
|
170 |
|
171 |
-
VIDEO_DATA = "https://www.youtube.com/watch?v=" + video_ids[0]
|
172 |
-
width = 80
|
173 |
-
side = 10
|
174 |
|
175 |
-
|
176 |
-
|
|
|
177 |
|
178 |
|
179 |
|
|
|
8 |
import numpy as np
|
9 |
import re
|
10 |
import urllib.request
|
11 |
+
import random
|
12 |
|
13 |
st.set_page_config(
|
14 |
page_title="FATA4 Science",
|
|
|
66 |
# query = input ("Enter your keyword(s):")
|
67 |
if query:
|
68 |
bar = st.progress(0)
|
69 |
+
time.sleep(.05)
|
70 |
st.caption(f":LightSkyBlue[searching {num_abstracts} {database_name} PubMed abstracts] covering 1990-2022")
|
71 |
|
72 |
for i in range(10):
|
|
|
164 |
mime='text/csv')
|
165 |
|
166 |
if query:
|
167 |
+
randomlist=[]
|
168 |
+
|
169 |
search_keyword = {query}
|
170 |
html = urllib.request.urlopen(f"https://www.youtube.com/results?search_query={database_name}")
|
171 |
video_ids = re.findall(r"watch\?v=(\S{11})", html.read().decode())
|
172 |
+
|
173 |
+
video_form = st.form(key=f"youTube videos for {database_name}")
|
174 |
+
c1, c2, c3 = st.columns(3)
|
175 |
+
with c1:
|
176 |
+
for i in range(50):
|
177 |
+
idx = random.randint(0, 20)
|
178 |
+
if idx not in randomlist:
|
179 |
+
randomlist.append(idx)
|
180 |
+
idx = idx
|
181 |
+
VIDEO_DATA = "https://www.youtube.com/watch?v=" + video_ids[idx]
|
182 |
+
width = 100
|
183 |
+
side = 1 # (100-width)/2
|
184 |
+
_, container, _ = st.columns([side, width, side])
|
185 |
+
container.video(data=VIDEO_DATA)
|
186 |
+
with c2:
|
187 |
+
for i in range(50):
|
188 |
+
idx = random.randint(0, 20)
|
189 |
+
if idx not in randomlist:
|
190 |
+
randomlist.append(idx)
|
191 |
+
idx = idx
|
192 |
+
VIDEO_DATA = "https://www.youtube.com/watch?v=" + video_ids[idx]
|
193 |
+
width = 100
|
194 |
+
side = 1
|
195 |
+
_, container, _ = st.columns([side, width, side])
|
196 |
+
container.video(data=VIDEO_DATA)
|
197 |
+
with c3:
|
198 |
+
for i in range(50):
|
199 |
+
idx = random.randint(0, 20)
|
200 |
+
if idx not in randomlist:
|
201 |
+
randomlist.append(idx)
|
202 |
+
idx = idx
|
203 |
+
VIDEO_DATA = "https://www.youtube.com/watch?v=" + video_ids[idx]
|
204 |
+
width = 100
|
205 |
+
side = 1
|
206 |
+
_, container, _ = st.columns([side, width, side])
|
207 |
+
container.video(data=VIDEO_DATA)
|
208 |
+
|
209 |
+
|
210 |
# st.video("https://www.youtube.com/watch?v=" + video_ids[0])
|
211 |
|
|
|
|
|
|
|
212 |
|
213 |
+
|
214 |
+
|
215 |
+
|
216 |
|
217 |
|
218 |
|