Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d51080c
First commit
hindesh-akash Aug 24, 2023
b876114
Requirements updated
hindesh-akash Aug 24, 2023
d77e7fb
Requirements update
hindesh-akash Aug 24, 2023
4285a44
Requirements update 2
hindesh-akash Aug 24, 2023
4a59885
Requirements update 2
hindesh-akash Aug 24, 2023
f7f02cd
Requirements update 2
hindesh-akash Aug 24, 2023
28dee7d
Requirements update 2
hindesh-akash Aug 24, 2023
e1dac11
Requirements update 2
hindesh-akash Aug 24, 2023
e9b425a
Requirements update 2
hindesh-akash Aug 24, 2023
5fcc4f8
Requirements update 2
hindesh-akash Aug 24, 2023
f70d91d
Requirements update 2
hindesh-akash Aug 24, 2023
8098b1c
Requirements update 2
hindesh-akash Aug 24, 2023
c1ac704
Requirements update 2
hindesh-akash Aug 24, 2023
ba3d5bd
Requirements update 2
hindesh-akash Aug 24, 2023
4068c5f
Requirements update 2
hindesh-akash Aug 24, 2023
b97f758
Requirements update 2
hindesh-akash Aug 24, 2023
554836d
Requirements update 2
hindesh-akash Aug 24, 2023
fae05a2
Requirements update 2
hindesh-akash Aug 24, 2023
ba018f7
Requirements update 2
hindesh-akash Aug 24, 2023
5996958
nothing
hindesh-akash Aug 24, 2023
07da82e
Merge branch 'feature'
hindesh-akash Aug 24, 2023
b19b2bb
main commit
hindesh-akash Aug 24, 2023
559a64c
main commit
hindesh-akash Aug 24, 2023
4ce028e
updated code
hindesh-akash Aug 24, 2023
ae51164
updated code
hindesh-akash Aug 24, 2023
d92d215
updated code
hindesh-akash Aug 24, 2023
6a60561
updated code final
hindesh-akash Aug 24, 2023
2154bc6
updated code final
hindesh-akash Aug 24, 2023
b16b133
update final
hindesh-akash Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
13 changes: 13 additions & 0 deletions .streamlit/credentials.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "service_account",
"project_id": "sebi-hackathon-sheets-db",
"private_key_id": "56fc605149245f890e4d36df6a862918fd8bf870",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCl/CDNECKsr0MH\nRTqkf9/VdDRY458JUquQkKaNV4sqN8N2LnbQTqaxPc9vM4fZ9RL8y3m3Qoztec/W\nWYPAORlT/SAv41l6AvahimTtiOjDpM5rK0lNMR3b61Aephlr6hJc3lNmaU8lRqLm\nU4XCMXy9HGiMyy4HtQvzHp7uYWfKLBjKiLGbd6v51U+HA9QylYm4K7lmqs/xWU4U\nm15f5WdRk242IuDzNSUGvENZph4tB4D2MZklSg1N+ffW6dmKhrPv6HR2PCtPVa1J\niDeyR9nP5bdJaURBWldSmJgX5LTkifOAVzm00/0GEQKLhjU1Be4pQp1fq3zMFCgq\nPgTfw+AxAgMBAAECggEAOcboMgk+UKbXKaY28gDTDM2c1R4ygz/EGZfIaeXBuunb\nP32P/RWLn6GY3aftz3gn6lf3n8tqG9Wte3sASf52Kw6u0AyO3lI+wF9Yn3hrMYLi\nGVrhcp24u48O/gQqUC6TwsDe/gSFOL/8Pzluk3i/Z2KGoA+vj549MR0FDIxaYPxl\n/Mriz6Vw4hhr+7e3arMknFOw69dltY0LVliddV/4PskulFYWWs7XhOLTrtykXEZf\nQ331/luvWE5OuoYpjzqu5SZh7LhwXEfXFZG7cYWSg8AJfk77U/l97Zo26mjEvsKP\nLObHILcbFR0YEz625Z3sasHcKI+jRKUwfUVPpsPwAwKBgQDTb92dp6azql0jWbV+\nJFCyyeHvfiDurnmAQADxHkq+U+HbTW+imuXZx9gT7HhhTODqSIhfrXXkDvouUULb\nMTNBt9Kacva5pl/9t+OLAwAJEV5TN+0jvC89z6/jiDs7msyDmjSNRhQdemh4VowF\nrYOx8wz9NpjCm+4CjtW4fdn4RwKBgQDI9+IWLIpOIp+LNU4TmElep5Y2eXRyDAem\nERzCpNoBqelgWTKxvyl6XpsxB3LFxReSvyGLydp1vvpSXTFjDM58zDBpvfAsX5gb\nliUy87vqvefNH7+KiizkARNPItdL98+bKl7vV+eYcOXQphL6mPGpsNV4uM5GiCVq\nfNXl6g6XxwKBgFuTivf6ogAVHKvv8eTFk9IsEFhrV5YpKWS70+ybAyJ2ME+MtXpG\n/qCZpuPSOr1hz9SJP8+40GPLfN5Mwdkv8RRYqrXMb0IvZkn8uGgAD6bdx+3hPiuJ\nGSj7aCHzYjxJqqShSHuby6CM4OymB5V59p0/OPP/DqDTan3fIX/7ukmHAoGAZlKP\nsmqLIK1QPjitwBxRfvgk6yd7unWVj2A3HIOC3EX+pSfFP+rs23k/2v7H2Ro4nmbi\nVaI4sKrEGRuKAbyLhc8Q90XV+0HQ2HriBcdDbomydCYuCAPCR3SkuC4tIGjUM1Sn\ncYV4TY1t9YYZM66bnKKEjirKG+9F3aoh3iYFuBECgYBmImItCOpF3wtkIys3s8oQ\nIJ1favSM4kAa0ujC8RgmGIlJmRoukG3BhKy6d4eGHUWFKR/3WtbMkU68cHIm8j0F\naETVUTwRwIdxjJE9d8NAkXT462iXBSyGnKpmvdoDUzbty4PMMc9stqcxXzk8Vuop\nHeDDLgogXN0T5a41yX9jAg==\n-----END PRIVATE KEY-----\n",
"client_email": "sebi-hackathon-service-acc@sebi-hackathon-sheets-db.iam.gserviceaccount.com",
"client_id": "111806018619958126515",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/sebi-hackathon-service-acc%40sebi-hackathon-sheets-db.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
13 changes: 13 additions & 0 deletions .streamlit/sebi-hackathon-sheets-db-56fc60514924.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "service_account",
"project_id": "sebi-hackathon-sheets-db",
"private_key_id": "56fc605149245f890e4d36df6a862918fd8bf870",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCl/CDNECKsr0MH\nRTqkf9/VdDRY458JUquQkKaNV4sqN8N2LnbQTqaxPc9vM4fZ9RL8y3m3Qoztec/W\nWYPAORlT/SAv41l6AvahimTtiOjDpM5rK0lNMR3b61Aephlr6hJc3lNmaU8lRqLm\nU4XCMXy9HGiMyy4HtQvzHp7uYWfKLBjKiLGbd6v51U+HA9QylYm4K7lmqs/xWU4U\nm15f5WdRk242IuDzNSUGvENZph4tB4D2MZklSg1N+ffW6dmKhrPv6HR2PCtPVa1J\niDeyR9nP5bdJaURBWldSmJgX5LTkifOAVzm00/0GEQKLhjU1Be4pQp1fq3zMFCgq\nPgTfw+AxAgMBAAECggEAOcboMgk+UKbXKaY28gDTDM2c1R4ygz/EGZfIaeXBuunb\nP32P/RWLn6GY3aftz3gn6lf3n8tqG9Wte3sASf52Kw6u0AyO3lI+wF9Yn3hrMYLi\nGVrhcp24u48O/gQqUC6TwsDe/gSFOL/8Pzluk3i/Z2KGoA+vj549MR0FDIxaYPxl\n/Mriz6Vw4hhr+7e3arMknFOw69dltY0LVliddV/4PskulFYWWs7XhOLTrtykXEZf\nQ331/luvWE5OuoYpjzqu5SZh7LhwXEfXFZG7cYWSg8AJfk77U/l97Zo26mjEvsKP\nLObHILcbFR0YEz625Z3sasHcKI+jRKUwfUVPpsPwAwKBgQDTb92dp6azql0jWbV+\nJFCyyeHvfiDurnmAQADxHkq+U+HbTW+imuXZx9gT7HhhTODqSIhfrXXkDvouUULb\nMTNBt9Kacva5pl/9t+OLAwAJEV5TN+0jvC89z6/jiDs7msyDmjSNRhQdemh4VowF\nrYOx8wz9NpjCm+4CjtW4fdn4RwKBgQDI9+IWLIpOIp+LNU4TmElep5Y2eXRyDAem\nERzCpNoBqelgWTKxvyl6XpsxB3LFxReSvyGLydp1vvpSXTFjDM58zDBpvfAsX5gb\nliUy87vqvefNH7+KiizkARNPItdL98+bKl7vV+eYcOXQphL6mPGpsNV4uM5GiCVq\nfNXl6g6XxwKBgFuTivf6ogAVHKvv8eTFk9IsEFhrV5YpKWS70+ybAyJ2ME+MtXpG\n/qCZpuPSOr1hz9SJP8+40GPLfN5Mwdkv8RRYqrXMb0IvZkn8uGgAD6bdx+3hPiuJ\nGSj7aCHzYjxJqqShSHuby6CM4OymB5V59p0/OPP/DqDTan3fIX/7ukmHAoGAZlKP\nsmqLIK1QPjitwBxRfvgk6yd7unWVj2A3HIOC3EX+pSfFP+rs23k/2v7H2Ro4nmbi\nVaI4sKrEGRuKAbyLhc8Q90XV+0HQ2HriBcdDbomydCYuCAPCR3SkuC4tIGjUM1Sn\ncYV4TY1t9YYZM66bnKKEjirKG+9F3aoh3iYFuBECgYBmImItCOpF3wtkIys3s8oQ\nIJ1favSM4kAa0ujC8RgmGIlJmRoukG3BhKy6d4eGHUWFKR/3WtbMkU68cHIm8j0F\naETVUTwRwIdxjJE9d8NAkXT462iXBSyGnKpmvdoDUzbty4PMMc9stqcxXzk8Vuop\nHeDDLgogXN0T5a41yX9jAg==\n-----END PRIVATE KEY-----\n",
"client_email": "sebi-hackathon-service-acc@sebi-hackathon-sheets-db.iam.gserviceaccount.com",
"client_id": "111806018619958126515",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/sebi-hackathon-service-acc%40sebi-hackathon-sheets-db.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
17 changes: 17 additions & 0 deletions .streamlit/secrets.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# .streamlit/secrets.toml

public_gsheets_url = "https://docs.google.com/spreadsheets/d/1w-zpQ66_hxtQfDlAidxmExSMBpUGGIAos9dvlRktk74/edit?usp=sharing"

openai_apikey = "---- ENTER YOUR API KEY HERE -----"

[gcp_service_account]
type = "service_account"
project_id = "sebi-hackathon-sheets-db"
private_key_id = "56fc605149245f890e4d36df6a862918fd8bf870"
private_key = "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCl/CDNECKsr0MH\nRTqkf9/VdDRY458JUquQkKaNV4sqN8N2LnbQTqaxPc9vM4fZ9RL8y3m3Qoztec/W\nWYPAORlT/SAv41l6AvahimTtiOjDpM5rK0lNMR3b61Aephlr6hJc3lNmaU8lRqLm\nU4XCMXy9HGiMyy4HtQvzHp7uYWfKLBjKiLGbd6v51U+HA9QylYm4K7lmqs/xWU4U\nm15f5WdRk242IuDzNSUGvENZph4tB4D2MZklSg1N+ffW6dmKhrPv6HR2PCtPVa1J\niDeyR9nP5bdJaURBWldSmJgX5LTkifOAVzm00/0GEQKLhjU1Be4pQp1fq3zMFCgq\nPgTfw+AxAgMBAAECggEAOcboMgk+UKbXKaY28gDTDM2c1R4ygz/EGZfIaeXBuunb\nP32P/RWLn6GY3aftz3gn6lf3n8tqG9Wte3sASf52Kw6u0AyO3lI+wF9Yn3hrMYLi\nGVrhcp24u48O/gQqUC6TwsDe/gSFOL/8Pzluk3i/Z2KGoA+vj549MR0FDIxaYPxl\n/Mriz6Vw4hhr+7e3arMknFOw69dltY0LVliddV/4PskulFYWWs7XhOLTrtykXEZf\nQ331/luvWE5OuoYpjzqu5SZh7LhwXEfXFZG7cYWSg8AJfk77U/l97Zo26mjEvsKP\nLObHILcbFR0YEz625Z3sasHcKI+jRKUwfUVPpsPwAwKBgQDTb92dp6azql0jWbV+\nJFCyyeHvfiDurnmAQADxHkq+U+HbTW+imuXZx9gT7HhhTODqSIhfrXXkDvouUULb\nMTNBt9Kacva5pl/9t+OLAwAJEV5TN+0jvC89z6/jiDs7msyDmjSNRhQdemh4VowF\nrYOx8wz9NpjCm+4CjtW4fdn4RwKBgQDI9+IWLIpOIp+LNU4TmElep5Y2eXRyDAem\nERzCpNoBqelgWTKxvyl6XpsxB3LFxReSvyGLydp1vvpSXTFjDM58zDBpvfAsX5gb\nliUy87vqvefNH7+KiizkARNPItdL98+bKl7vV+eYcOXQphL6mPGpsNV4uM5GiCVq\nfNXl6g6XxwKBgFuTivf6ogAVHKvv8eTFk9IsEFhrV5YpKWS70+ybAyJ2ME+MtXpG\n/qCZpuPSOr1hz9SJP8+40GPLfN5Mwdkv8RRYqrXMb0IvZkn8uGgAD6bdx+3hPiuJ\nGSj7aCHzYjxJqqShSHuby6CM4OymB5V59p0/OPP/DqDTan3fIX/7ukmHAoGAZlKP\nsmqLIK1QPjitwBxRfvgk6yd7unWVj2A3HIOC3EX+pSfFP+rs23k/2v7H2Ro4nmbi\nVaI4sKrEGRuKAbyLhc8Q90XV+0HQ2HriBcdDbomydCYuCAPCR3SkuC4tIGjUM1Sn\ncYV4TY1t9YYZM66bnKKEjirKG+9F3aoh3iYFuBECgYBmImItCOpF3wtkIys3s8oQ\nIJ1favSM4kAa0ujC8RgmGIlJmRoukG3BhKy6d4eGHUWFKR/3WtbMkU68cHIm8j0F\naETVUTwRwIdxjJE9d8NAkXT462iXBSyGnKpmvdoDUzbty4PMMc9stqcxXzk8Vuop\nHeDDLgogXN0T5a41yX9jAg==\n-----END PRIVATE KEY-----\n"
client_email = "sebi-hackathon-service-acc@sebi-hackathon-sheets-db.iam.gserviceaccount.com"
client_id = "111806018619958126515"
auth_uri = "https://accounts.google.com/o/oauth2/auth"
token_uri = "https://oauth2.googleapis.com/token"
auth_provider_x509_cert_url = "https://www.googleapis.com/oauth2/v1/certs"
client_x509_cert_url = "https://www.googleapis.com/robot/v1/metadata/x509/sebi-hackathon-service-acc%40sebi-hackathon-sheets-db.iam.gserviceaccount.com"
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
}
20 changes: 20 additions & 0 deletions 01_homepage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Import necessary libraries
import streamlit as st
from streamlit_player import st_player

st.set_page_config(
page_title="Smart With Sebi",
page_icon=":detective:",
layout="wide",
)

with st.columns(3)[1]:
st.image("media/smart_with_sebi.jpeg", width=200)

st.markdown("<h2 style='text-align: center; color: black;'>Welcome to Smart with SEBI portal</h1>", unsafe_allow_html=True)

st.markdown("<h3 style='text-align: left; color: black;'><hr> About this project:</h3>", unsafe_allow_html=True)

st.sidebar.success("Select a page above!")

st_player("https://www.youtube.com/watch?v=jNVTSDwTm14")
65 changes: 58 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,69 @@

## README.md must consist of the following information:

#### Team Name -
#### Problem Statement -
#### Team Leader Email -
#### Team Name - Emperor
#### Problem Statement - Misleading Claim Detection & Content Curation
#### Team Leader Email - [email protected]
#### Project Demo Link: <https://www.youtube.com/watch?v=jNVTSDwTm14>
#### Project hosted at: <https://sebi-misleading-claim-detection.streamlit.app/>

## A Brief of the Prototype:
This section must include UML Diagrams and prototype description
![use_case](use_case.png)

Working:

1. There are two separate portals, one for common user which includes claim detection and educational content generation and other for SEBI personnel for claim detection and features like source reliability rating.

2. At-first any user inputs TEXT/AUDIO/VIDEO/IMAGE (currently only upload is supported, Web Scraping is reserved for future use-case) then the input is converted to text first.

3. The text prompt is passed through OpenAI's whisper-1 model with precise prompt to output whether is claim is misleading or not, and based on certain financial points, suppose the input is:
"Invest into company A, which is giving good returns."
Certain financial keywords: invest, returns are extracted and then based on these key words, videos from YouTube are suggested to the user.

4. **MOST IMPORTANT FEATURES for SEBI Personnel:**

4.1. Based on the input claim, certain rules and regulations are also suggested based upon mapping from the financial concept to the SEBI rules and regulations database.\

4.2. A source reliability rating database in the form of Google Sheets is connected to the app so that whenever any claim is being judged, it is pushed to tha database (Google Sheet) and a score is marked for each claim type: -1 for MISLEADING and +1 for NOT MISLEADING, based on the cumulative scores a ranking is assigned and displayed.



## Tech Stack:
List Down all technologies used to Build the prototype
Following technologies were used:\
1. Streamlit - for web-development\
2. HuggingFace - for sentiment analysis pipeline\
3. LangChain - For accessing OpenAI \
4. PyTesseract - for Optical Character Recognition\
5. pydub - for audio segmentation\
6. moviePy - for detaching audio from video\
7. GoogleSheets - for backend database

## Step-by-Step Code Execution Instructions:
This Section must contain a set of instructions required to clone and run the prototype so that it can be tested and deeply analyzed
1. clone the repository:
```
git clone https://github.com/hindesh-akash/Empowering-Investors-Hackathon.git
```

2. **IMPORTANT**:

-> Go to '.streamlit/secrets.toml' \
-> Enter your OpenAI api key in 'openai_apikey' variable \
-> save and exit
3. Open a new python terminal
4. Run the command:
```
pip install -r requirements.txt
```
```
streamlit run 01_homepage.py
```
5. Explore the app


## What I Learned:
Write about the biggest learning you had while developing the prototype
I learned about what problems are faced in real world by common people, money is the neccessity of human being, and a person invests his/her money in order to get positive returns so that they can make their living better.
And we as contributors can help them achieve the goal.\
I faced many challenges while developing the prototype, especially connecting with the database and APIs, but in the end when I see the application of this project in real world, I feel great motivation to develop a fully functional solution.

Thank you for this opportunity!

Binary file added __pycache__/apikey.cpython-310.pyc
Binary file not shown.
Binary file added __pycache__/prompts.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file added __pycache__/utils.cpython-310.pyc
Binary file not shown.
25 changes: 25 additions & 0 deletions apikey.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import streamlit as st

apikey = st.secrets['openai_apikey'] #Bobby key

''

'''NOTE:
This is the API key for the OpenAI API. It is a secret key and should not be shared with anyone.
The key provided here is my personal key for demonstration purposes only on a trial version of the API.
Please do not misuse this key.


IF THERE IS API KEY PROBLEM, you can enter your own API KEY here.
Follow the steps:

1. Go to www.openai.com
2. Sign up for an account
3. Go to your dashboard
4. Click on the "Billing" tab
5. Click on the "API Keys" tab
6. Click on "Create new API key"
7. Copy the key and paste it in the apikey variable above

'''

Binary file added media/demo_video.mp4
Binary file not shown.
Binary file added media/influencer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/smart_with_sebi.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/text_influencer.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/wirecard_audio.ogg
Binary file not shown.
26 changes: 26 additions & 0 deletions new_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import streamlit as st

import gspread
from oauth2client.service_account import ServiceAccountCredentials

# Authenticate with Google Sheets API
scope = ["https://spreadsheets.google.com/feeds", "https://www.googleapis.com/auth/drive"]
credentials = ServiceAccountCredentials.from_json_keyfile_name("credentials.json", scope)
client = gspread.authorize(credentials)

st.success("connection done")

# Open the Google Sheet by its title
sheet = client.open("sebi-hackathon-db")
st.success("Sheet loaded")

worksheet = sheet.get_worksheet(0) # Assuming you want to work with the first worksheet
st.success("Worksheet loaded")

# # Define the data for the new row
new_row_data = ["Value1", "Value2", "Value3","Val4","val5"]

# # Append the new row to the worksheet
worksheet.append_row(new_row_data)

st.success("Row appended")
100 changes: 100 additions & 0 deletions pages/02_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# --- IMPORT DEPENDENCIES -------------------------------+
import sys
import streamlit as st

# setting path

sys.path.append("../prompts")
sys.path.append("../utils")

from prompts import *
from utils import *
from streamlit_option_menu import option_menu


# --- TITLE --------------------------------------------+
with st.columns(3)[1]:
st.image("media/smart_with_sebi.jpeg", width=200)

st.markdown("<h2 style='text-align: center; color: black;'> USER PORTAL<hr></h2>", unsafe_allow_html=True)


# --- OPTION MENU --------------------------------------+
selected = option_menu(
menu_title=None,
options=["TEXT", "AUDIO", "VIDEO", "IMAGE", "QnA"],
icons=["card-text", "volume-up", "camera-reels", "image", "question-circle"],
menu_icon="cast",
orientation="horizontal",
styles={
"container": {"padding": "0!important", "background-color": "#fafafa"},
"icon": {"color": "orange", "font-size": "25px"},
"nav-link": {"font-size": "20px", "text-align": "left", "margin":"0px", "--hover-color": "#eee"},
"nav-link-selected": {"background-color": "indigo"},
},
)

# Main content based on user's selected
if selected == "TEXT":
st.write("**TEXT BASED CLAIM DETECTION:**\n\n")
prompt = st.text_area("User Input")

if st.button("Submit") and prompt:
claim_detection_pipeline(prompt)
financial_points = financial_point_extractor(prompt)
display_video_links(financial_points)
# display_articles(financial_points)


if selected == "AUDIO":
st.write("**AUDIO BASED CLAIM DETECTION:**")
audio_file = st.file_uploader("Upload an audio file", type=["ogg", "mp3", "wav"])

if audio_file:
st.audio(audio_file, format="audio/ogg", start_time=0)
transcript = transcribe_audio(audio_file)
prompt = st.text_area("Transcribed User Input", value=transcript)
if st.button("Submit") and prompt:
claim_detection_pipeline(prompt)
financial_points = financial_point_extractor(prompt)
display_video_links(financial_points)


if selected == "IMAGE":
st.write("**IMAGE BASED CLAIM DETECTION:**")
image_file = st.file_uploader("Upload an image file", type=["png", "jpg", "jpeg"])

if image_file:
st.image(
image_file, caption="Uploaded Image.", use_column_width=True, width=300
)
text_from_image = get_text_from_image(image_file)
prompt = st.text_area("User input image to text:", value=text_from_image)

if st.button("Submit") and prompt:
claim_detection_pipeline(prompt)
financial_points = financial_point_extractor(prompt)
display_video_links(financial_points)

if selected == "QnA":
st.write("**Question - Answering**")
prompt = st.text_area("User Input")

if st.button("Submit") and prompt:
question_and_answer(prompt)

if selected == "VIDEO":
st.write("**VIDEO BASED CLAIM DETECTION:**")
video_file = st.file_uploader("Upload a video file", type=["mp4", "mov", "avi"])

if video_file:
st.video(video_file, start_time=0)
#----------------------------------------
transcript = video_to_text(video_file)
#----------------------------------------
prompt = st.text_area("Transcribed User Input", value=transcript)

if st.button("Submit") and prompt:
claim_detection_pipeline(prompt)
financial_points = financial_point_extractor(prompt)
display_video_links(financial_points)
Loading