⚠
️ DEPRECATED GITLAB INSTANCE
⚠
️ This GitLab is now read-only for reference. Please use
https://gitlab.iauro.co
for all new work.
Migration completed on September 17, 2025
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Gen AI Assignment
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mitul Lakkad
Gen AI Assignment
Commits
be57f5f5
Commit
be57f5f5
authored
Jun 03, 2025
by
pragati-siddhiinfosoft
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assignment 3 completed
parent
e395c0c9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
0 deletions
+92
-0
streamlit_stock_app/app.py
streamlit_stock_app/app.py
+79
-0
streamlit_stock_app/requirements.txt
streamlit_stock_app/requirements.txt
+13
-0
No files found.
streamlit_stock_app/app.py
0 → 100644
View file @
be57f5f5
import
streamlit
as
st
import
yfinance
as
yf
import
pandas
as
pd
from
sumy.parsers.plaintext
import
PlaintextParser
from
sumy.nlp.tokenizers
import
Tokenizer
from
sumy.summarizers.lsa
import
LsaSummarizer
# --------------------------------
# Page configuration
# --------------------------------
st
.
set_page_config
(
page_title
=
"Stock Dashboard & Summarizer"
,
layout
=
"wide"
)
# --------------------------------
# App Title and Description
# --------------------------------
st
.
title
(
"📈 Stock Price Dashboard & 📝 Summarizer"
)
st
.
markdown
(
"""
Welcome to the **Stock Analysis App** built with Streamlit.
- Search and visualize **stock price trends**
- Paste stock-related news or description for **automatic summarization**
"""
)
# --------------------------------
# User Input Section
# --------------------------------
st
.
sidebar
.
header
(
"User Input"
)
stock_symbol
=
st
.
sidebar
.
text_input
(
"Enter Stock Symbol (e.g., AAPL, MSFT)"
,
value
=
"AAPL"
)
days
=
st
.
sidebar
.
slider
(
"Select number of past days"
,
min_value
=
5
,
max_value
=
365
,
value
=
30
)
# --------------------------------
# Function to fetch stock data
# --------------------------------
@
st
.
cache_data
def
fetch_stock_data
(
symbol
,
days
):
return
yf
.
download
(
symbol
,
period
=
f
"{days}d"
)
# --------------------------------
# Display stock chart
# --------------------------------
st
.
subheader
(
f
"📊 Stock Price Chart for {stock_symbol}"
)
if
st
.
sidebar
.
button
(
"Load Stock Data"
):
try
:
stock_data
=
fetch_stock_data
(
stock_symbol
,
days
)
if
not
stock_data
.
empty
:
st
.
line_chart
(
stock_data
[
'Close'
])
st
.
metric
(
"Latest Close Price"
,
f
"${stock_data['Close'].iloc[-1]:.2f}"
)
else
:
st
.
warning
(
"No data found for this symbol."
)
except
Exception
as
e
:
st
.
error
(
f
"Error fetching data: {e}"
)
# --------------------------------
# Text Summarization Section
# --------------------------------
st
.
markdown
(
"---"
)
st
.
subheader
(
"📝 Stock News or Description Summarizer"
)
text_input
=
st
.
text_area
(
"Paste any stock-related text here to summarize"
)
# Function to summarize text
def
summarize_text
(
text
,
sentence_count
=
2
):
parser
=
PlaintextParser
.
from_string
(
text
,
Tokenizer
(
"english"
))
summarizer
=
LsaSummarizer
()
summary
=
summarizer
(
parser
.
document
,
sentence_count
)
return
" "
.
join
(
str
(
sentence
)
for
sentence
in
summary
)
# Button to trigger summarization
if
st
.
button
(
"Generate Summary"
):
if
text_input
.
strip
():
summary
=
summarize_text
(
text_input
)
st
.
success
(
"**Summary:**"
)
st
.
write
(
summary
)
else
:
st
.
warning
(
"Please enter some text first."
)
# --------------------------------
# Footer
# --------------------------------
st
.
markdown
(
"---"
)
st
.
markdown
(
"Built with [Streamlit](https://streamlit.io/) | By Mitul Lakkad"
)
\ No newline at end of file
streamlit_stock_app/requirements.txt
0 → 100644
View file @
be57f5f5
streamlit
yfinance
sumy
pandas
numpy
nltk
scikit-learn
matplotlib
seaborn
plotly
requests
beautifulsoup4
lxml
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment