Skip to content

Commit c88ef72

Browse files
committedNov 8, 2024
🦊 [v1.1.0] Final changes?
1 parent b96eb48 commit c88ef72

File tree

7 files changed

+16
-10
lines changed

7 files changed

+16
-10
lines changed
 

‎python-app/app.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
CORSMiddleware,
1616
allow_origins=['*'],
1717
allow_methods=['*'],
18-
allow_headers=['*']
18+
allow_headers=['*'],
19+
allow_credentials=True
1920
)
2021

2122
@app.post('/api/archive')
@@ -25,6 +26,7 @@ async def archive(request: Request) -> JSONResponse:
2526
source = request_body.get('source')
2627
date = request_body.get('date')
2728
topic = request_body.get('topic')
29+
2830
if not source or not date or not topic:
2931
raise HTTPException(status_code=400, detail='Source, date, or topic is missing')
3032

@@ -53,10 +55,13 @@ async def url(request: Request) -> JSONResponse:
5355
data = await ndtv_url(url)
5456
return JSONResponse(data)
5557

58+
@app.post('/api/pdf')
59+
async def pdf(request: Request) -> JSONResponse:
60+
pass # Feature under development
61+
5662
if __name__ == '__main__':
5763
# Start the Streamlit app in a separate process
5864
streamlit_process = subprocess.Popen(['streamlit', 'run', 'python-app/home.py'])
59-
6065
try:
6166
# Start the FastAPI server
6267
uvicorn.run(app)

‎python-app/gemini.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
]
3131

3232
# Load system instructions for the Gemini model
33-
with open('gemini_instructions.md', 'r') as file:
33+
with open('metadata/gemini_instructions.md', 'r') as file:
3434
gemini_instructions = file.read()
3535

3636
# Initialize the Gemini model with custom settings and instructions

‎python-app/graphs.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def pie_chart(title: str, labels: List[str], values: List[float], colors: List[s
5151
)
5252
plotly_chart(figure, use_container_width=True)
5353

54-
def horizontal_bar_chart(title: str, counts: List[int], labels: List[str], x_label: str, y_label: str, colors: List[str]) -> None:
54+
def horizontal_bar_chart(title: str, counts: List[int], labels: List[str], x_label: str, y_label: str,
55+
colors: List[str]) -> None:
5556
# Create a horizontal bar chart using Plotly Express
5657
figure = px.bar(
5758
title=title,

‎python-app/home.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ def home() -> None:
1919
initial_sidebar_state='collapsed'
2020
)
2121
st.markdown(
22-
"<h1 style='text-align: center;'>Gods Eye: Automated Feedback System</h1>",
22+
"<h1 style='text-align: center;'>Gods Eye: Automated News Feedback System</h1>",
2323
unsafe_allow_html=True
2424
)
2525
st.divider()
2626
st.info('NOTE: The application is currently in alpha phase. Some features are limited and undergoing development.', icon=':material/info:')
2727

2828
# Load news sources and topics for the search functionality
29-
with open('news_config.json') as file:
29+
with open('metadata/news_config.json') as file:
3030
news_data = json.load(file)
3131

3232
# Create a 3-column layout with custom widths

‎python-app/pages/5_technology.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def technology() -> None:
2222
"""
2323
## Project Description
2424
25-
The automated feedback system uses web crawlers to create a dataset of news articles, scrape article URLs, and optical character recognition technology to extract content from e-papers. The system is built with the Streamlit framework to generate graphs using the Plotly library for visualization on scraped data.
25+
The automated news feedback system uses web crawlers to create a dataset of news articles, scrape article URLs, and optical character recognition technology to extract content from e-papers. The system is built with the Streamlit framework to generate graphs using the Plotly library for visualization on scraped data.
2626
2727
Additionally, the system includes a chatbot (powered by Gemini API) that provides perspective on the latest news for users and a Chrome extension for real-time fake news detection.
2828

‎python-app/pages/6_feedback.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def feedback() -> None:
5555
unsafe_allow_html=True
5656
)
5757

58-
def send_mail(name, email, message) -> str:
58+
def send_mail(name: str, email: str, message: str) -> str:
5959
# Load admin email and password from Streamlit secrets.toml
6060
# ADMIN_EMAIL = st.secrets["admin"]["email"]
6161
# ADMIN_PASSWORD = st.secrets["admin"]["app_pass"]

‎python-app/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def custom_css() -> None:
1919
unsafe_allow_html=True
2020
)
2121

22-
# Function to create a person card component with name, image, role, email, GitHub, and LinkedIn links
23-
def person_card(name, image_path, role, email, github_link, linkedin_link) -> None:
22+
# Function to create a person card component with name, image, role, email, github, and linkedin links
23+
def person_card(name: str, image_path: str, role: str, email: str, github_link: str, linkedin_link: str) -> None:
2424
custom_css()
2525
st.image(image_path, use_column_width=True)
2626
st.markdown(

0 commit comments

Comments
 (0)