Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -504,7 +504,6 @@ if st.session_state['parsed']:
|
|
504 |
# urls = search(google_query_term+' news latest', num_results=10)
|
505 |
st.session_state['wiki_summary'] = False
|
506 |
all_related_entity = []
|
507 |
-
print(related_entity, ' _____')
|
508 |
for el in related_entity[:-2]:
|
509 |
if isinstance(el, str):
|
510 |
all_related_entity.append(el)
|
@@ -514,11 +513,9 @@ if st.session_state['parsed']:
|
|
514 |
all_related_entity.extend(el)
|
515 |
# [ if type(el) == 'int' all_related_entity.extend(el) else all_related_entity.extend([el])for el in related_entity]
|
516 |
for entity in all_related_entity:
|
517 |
-
# print(all_related_entity)
|
518 |
# try:
|
519 |
if True:
|
520 |
if entity:
|
521 |
-
print(entity)
|
522 |
entity = entity.replace(' ', '_')
|
523 |
query = f'''
|
524 |
SELECT ?name ?comment ?image
|
@@ -546,7 +543,6 @@ if st.session_state['parsed']:
|
|
546 |
st.write(image_url)
|
547 |
# try:
|
548 |
response = requests.get(image_url)
|
549 |
-
# display(Image.open(BytesIO(response.content)))
|
550 |
try:
|
551 |
related_image = Image.open(BytesIO(response.content))
|
552 |
st.image(related_image)
|
@@ -559,7 +555,7 @@ if st.session_state['parsed']:
|
|
559 |
summary_entity = comment
|
560 |
wiki_knowledge_df = pd.read_html(wiki_url)[0]
|
561 |
wiki_knowledge_df = filter_wiki_df(wiki_knowledge_df)
|
562 |
-
|
563 |
st.write('Showing desciption for entity:', name)
|
564 |
st.dataframe(wiki_knowledge_df)
|
565 |
# if st.button('Want something else?'):
|
@@ -567,8 +563,6 @@ if st.session_state['parsed']:
|
|
567 |
break
|
568 |
# summary_entity = wikipedia.summary(entity, 3)
|
569 |
else:
|
570 |
-
print(qres)
|
571 |
-
print(query)
|
572 |
summary_entity = None
|
573 |
if not summary_entity:
|
574 |
try:
|
@@ -583,5 +577,4 @@ if st.session_state['parsed']:
|
|
583 |
st.write(f'Summary for {selected_entity["Name"][0]}')
|
584 |
st.write(summary_entity)
|
585 |
|
586 |
-
|
587 |
|
|
|
504 |
# urls = search(google_query_term+' news latest', num_results=10)
|
505 |
st.session_state['wiki_summary'] = False
|
506 |
all_related_entity = []
|
|
|
507 |
for el in related_entity[:-2]:
|
508 |
if isinstance(el, str):
|
509 |
all_related_entity.append(el)
|
|
|
513 |
all_related_entity.extend(el)
|
514 |
# [ if type(el) == 'int' all_related_entity.extend(el) else all_related_entity.extend([el])for el in related_entity]
|
515 |
for entity in all_related_entity:
|
|
|
516 |
# try:
|
517 |
if True:
|
518 |
if entity:
|
|
|
519 |
entity = entity.replace(' ', '_')
|
520 |
query = f'''
|
521 |
SELECT ?name ?comment ?image
|
|
|
543 |
st.write(image_url)
|
544 |
# try:
|
545 |
response = requests.get(image_url)
|
|
|
546 |
try:
|
547 |
related_image = Image.open(BytesIO(response.content))
|
548 |
st.image(related_image)
|
|
|
555 |
summary_entity = comment
|
556 |
wiki_knowledge_df = pd.read_html(wiki_url)[0]
|
557 |
wiki_knowledge_df = filter_wiki_df(wiki_knowledge_df)
|
558 |
+
|
559 |
st.write('Showing desciption for entity:', name)
|
560 |
st.dataframe(wiki_knowledge_df)
|
561 |
# if st.button('Want something else?'):
|
|
|
563 |
break
|
564 |
# summary_entity = wikipedia.summary(entity, 3)
|
565 |
else:
|
|
|
|
|
566 |
summary_entity = None
|
567 |
if not summary_entity:
|
568 |
try:
|
|
|
577 |
st.write(f'Summary for {selected_entity["Name"][0]}')
|
578 |
st.write(summary_entity)
|
579 |
|
|
|
580 |
|