Spaces:
Sleeping
Sleeping
KrSharangrav
commited on
Commit
·
ba2af1a
1
Parent(s):
0105e3b
Fixing csv read errors and requirements
Browse files- app.py +6 -3
- requirements.txt +3 -1
app.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
|
|
|
|
3 |
from pymongo import MongoClient
|
4 |
from transformers import pipeline
|
5 |
|
@@ -15,13 +17,14 @@ collection = get_mongo_client()
|
|
15 |
csv_url = "https://huggingface.co/spaces/sharangrav24/SentimentAnalysis/resolve/main/sentiment140.csv"
|
16 |
|
17 |
try:
|
18 |
-
|
|
|
|
|
|
|
19 |
except Exception as e:
|
20 |
st.error(f"Error loading dataset: {e}")
|
21 |
st.stop()
|
22 |
|
23 |
-
st.success("Dataset Loaded Successfully!")
|
24 |
-
|
25 |
#### **3. Sentiment Analysis using BERT-ROBERTA**
|
26 |
st.info("Running Sentiment Analysis...")
|
27 |
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
+
import requests
|
4 |
+
import io
|
5 |
from pymongo import MongoClient
|
6 |
from transformers import pipeline
|
7 |
|
|
|
17 |
csv_url = "https://huggingface.co/spaces/sharangrav24/SentimentAnalysis/resolve/main/sentiment140.csv"
|
18 |
|
19 |
try:
|
20 |
+
response = requests.get(csv_url)
|
21 |
+
response.raise_for_status() # Ensure the request was successful
|
22 |
+
df = pd.read_csv(io.StringIO(response.text), encoding="ISO-8859-1")
|
23 |
+
st.success("Dataset Loaded Successfully!")
|
24 |
except Exception as e:
|
25 |
st.error(f"Error loading dataset: {e}")
|
26 |
st.stop()
|
27 |
|
|
|
|
|
28 |
#### **3. Sentiment Analysis using BERT-ROBERTA**
|
29 |
st.info("Running Sentiment Analysis...")
|
30 |
|
requirements.txt
CHANGED
@@ -8,4 +8,6 @@ sentencepiece==0.1.99
|
|
8 |
scipy==1.10.1
|
9 |
huggingface_hub==0.20.3
|
10 |
pydantic==1.10.13
|
11 |
-
typing-extensions
|
|
|
|
|
|
8 |
scipy==1.10.1
|
9 |
huggingface_hub==0.20.3
|
10 |
pydantic==1.10.13
|
11 |
+
typing-extensions==4.5.0
|
12 |
+
requests==2.31.0
|
13 |
+
protobuf==4.25.1
|