Learto commited on
Commit
b41d4ff
·
1 Parent(s): cb9991a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -12
app.py CHANGED
@@ -1,12 +1,21 @@
1
- import requests
2
-
3
- API_URL = "https://api-inference.huggingface.co/models/carloszansavio/bert-financial-sentiment-analysis"
4
- headers = {"Authorization": f"Bearer {API_TOKEN}"}
5
-
6
- def query(payload):
7
- response = requests.post(API_URL, headers=headers, json=payload)
8
- return response.json()
9
-
10
- output = query({
11
- "inputs": "I like you. I love you",
12
- })
 
 
 
 
 
 
 
 
 
 
1
+ # ***** Finacial Sentiment Analysis App *****
2
+ # Team *** AI Supremo
3
+ # Author *** Lerato Chere
4
+
5
+ import streamlit as st
6
+ from transformers import pipeline
7
+
8
+ sentiment_pipeline = pipeline("sentiment-analysis")
9
+
10
+ st.title("Financial Sentiment Analysis \n Team AI Supremo ")
11
+ st.write("Enter a Financial Statement to Analyze the Sentiment:")
12
+ user_input = st.text_input("")
13
+ st.write("Press the Enter key")
14
+
15
+ if user_input:
16
+ result = sentiment_pipeline(user_input)
17
+ sentiment = result[0]["label"]
18
+ confidence = result[0]["score"]
19
+
20
+ st.write(f"Sentiment: {sentiment}")
21
+ st.write(f"Confidence: {confidence:.2%}")