Skip to content

Commit

Permalink
initial upload
Browse files Browse the repository at this point in the history
  • Loading branch information
coffee-and-debugging committed May 11, 2024
1 parent ddb8ff7 commit d9f27f7
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 69 deletions.
Binary file added __pycache__/gather.cpython-311.pyc
Binary file not shown.
9 changes: 9 additions & 0 deletions gather.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import requests
from bs4 import BeautifulSoup

def gather(keyword):
url = "https://en.wikipedia.org/wiki/" + keyword
response = requests.get(url)
soup = BeautifulSoup(response.content, "html.parser")
details = soup.find_all('table', {'class': 'infobox'})
return details, soup('p')[:2]
32 changes: 32 additions & 0 deletions infohunt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import streamlit as st
from gather import gather

def main():
st.markdown(
'<div style="text-align:center"><img src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExMDlhMDN3MncyZWRkemh5b2h0cmI2bWUwaTN3MmZkaTJ6cWJtZGxvNyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/1QGRJ9cOTbh5K/giphy.gif" width="500" height="150"></div>',
unsafe_allow_html=True
)
st.markdown('<h1 style="text-align: center;">InFo_hUnT</h1>', unsafe_allow_html=True)
input_data = st.text_input("Enter your word")
if input_data:
keyword = "_".join(input_data.strip().split())
details, paragraphs = gather(keyword)

if details:
st.write("### Structured Data '{}'".format(input_data))
for detail in details:
rows = detail.find_all('tr')
for row in rows:
heading = row.find('th')
detail = row.find('td')
if heading and detail:
st.write("**{}:** {}".format(heading.text.strip(), detail.text.strip()))
else:
st.write(" Stuctured data not yet available for '{}'".format(input_data))

st.write("### Summary for '{}'".format(input_data))
for paragraph in paragraphs:
st.write(paragraph.text.strip())

if __name__ == "__main__":
main()
32 changes: 0 additions & 32 deletions main.py

This file was deleted.

Binary file added template/search.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 0 additions & 37 deletions test.py

This file was deleted.

0 comments on commit d9f27f7

Please sign in to comment.