Skip to content

Commit

Permalink
Merge branch 'master' into temp_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Sai-ganesh-0004 authored Oct 19, 2024
2 parents c164887 + 246f52a commit 11128c0
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 36 deletions.
33 changes: 0 additions & 33 deletions .devcontainer/devcontainer.json

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/validate-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Validate PR

on:
pull_request:
branches: [ master ]
types: [opened, synchronize, reopened, ready_for_review]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.12]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Ubuntu packages
run: |
sudo apt-get update
sudo xargs -a packages.txt apt-get install -y
shell: bash

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Validate dependencies with pip-check
run: |
pip install pip-check
pip-check
continue-on-error: false # Fail the workflow if dependencies are invalid

- name: Test Streamlit App
run: |
pip install streamlit
streamlit run App.py --server.headless true --browser.gatherUsageStats false &
sleep 10 # Wait for the app to start
curl --retry 5 --retry-delay 5 http://localhost:8501
env:
STREAMLIT_SERVER_HEADLESS: true
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
__pycache__
venv
*.log
2 changes: 2 additions & 0 deletions App.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
- **GLD**: The price of SPDR Gold Shares (GLD), which is the target variable representing gold prices.
"""
)

st.write(
"- **Car Price Predictor**: Estimate the price of a car based on various features."
)
Expand Down Expand Up @@ -146,3 +147,4 @@
- **Seats**: The number of seats in the car.
"""
)

10 changes: 10 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Development dependencies for the project.
# Includes Jupyter and other tools used during development, but not required for the Streamlit app in production.

jupyterlab
notebook

# jupyterlab==4.2.5
# jupyterlab_pygments==0.3.0
# jupyterlab_server==2.27.3
# jupyterlab_widgets==3.0.13
13 changes: 13 additions & 0 deletions models/text_sumarization/predict.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from transformers import pipeline
import streamlit as st

@st.cache_resource(show_spinner=True) # Cache the model loading for faster performance
def load_summarizer():
"""Load and cache the text summarization pipeline model."""
return pipeline("summarization", model="t5-small")

def generate_summary(text: str) -> str:
"""Generate a summary for the given input text."""
summarizer = load_summarizer()
summary = summarizer(text, max_length=150, min_length=30, do_sample=False)
return summary[0]["summary_text"]
19 changes: 19 additions & 0 deletions pages/Text Summarizer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import streamlit as st
from models.text_sumarization.predict import generate_summary

st.title("Text Summarization Tool")

st.write("Enter the text you'd like to summarize (minimum 50 words).")

user_input = st.text_area("Input Text", height=250)

# A button to initiate the summarization process
if st.button("Summarize"):
if len(user_input.split()) < 50:
st.warning("Please enter at least 50 words for summarization.")
else:
# Show a spinner while the summarization is being processed
with st.spinner("Summarizing..."):
summary = generate_summary(user_input) # Call the function from predict.py
st.subheader("Summary:")
st.code(summary, language="text", wrap_lines=True)
2 changes: 2 additions & 0 deletions pages/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
},

"Malware_Detection": {

"title": "PDF Malware Detection",
"page_title": "PDF Malware Detection",
"page_icon": "\ud83d\udd12",
Expand Down Expand Up @@ -173,4 +174,5 @@
}
]
}

}
6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ matplotlib-inline==0.1.7
mdurl==0.1.2
mistune==3.0.2
narwhals==1.8.1
numpy==2.1.1
numpy
openpyxl==3.1.5
overrides==7.7.0
packaging==24.1
Expand All @@ -78,7 +78,7 @@ pluggy==1.5.0
prometheus_client==0.20.0
prompt_toolkit==3.0.47
prophet==1.1.6
protobuf==5.28.2
protobuf==4.25.5
psutil==6.0.0
pure_eval==0.2.3
pyarrow==17.0.0
Expand Down Expand Up @@ -138,3 +138,5 @@ webcolors==24.8.0
webencodings==0.5.1
websocket-client==1.8.0
xgboost==2.1.1
transformers==4.45.2
tf_keras==2.17.0

0 comments on commit 11128c0

Please sign in to comment.