Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,31 @@
|
|
1 |
import pandas as pd
|
2 |
import streamlit as st
|
3 |
-
from textblob import TextBlob
|
4 |
import re
|
5 |
import matplotlib.pyplot as plt
|
6 |
-
|
7 |
import nltk
|
8 |
from nltk.corpus import stopwords
|
9 |
from collections import Counter
|
10 |
from wordcloud import WordCloud
|
11 |
nltk.download('stopwords')
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
st.set_page_config(
|
14 |
page_title="Smart Farming Sentiment Analysis",
|
15 |
page_icon="🌱",
|
16 |
layout="wide"
|
17 |
)
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
def set_cleantext(dataframe):
|
20 |
#Sentence less than 10 words
|
21 |
dataframe = dataframe[dataframe['sentences'].apply(lambda x: len(x.split()) >= 10)]
|
|
|
1 |
import pandas as pd
|
2 |
import streamlit as st
|
|
|
3 |
import re
|
4 |
import matplotlib.pyplot as plt
|
5 |
+
from textblob import TextBlob
|
6 |
import nltk
|
7 |
from nltk.corpus import stopwords
|
8 |
from collections import Counter
|
9 |
from wordcloud import WordCloud
|
10 |
nltk.download('stopwords')
|
11 |
|
12 |
+
#Huggingface
|
13 |
+
from datasets import load_dataset
|
14 |
+
from huggingface_hub import login
|
15 |
+
import os
|
16 |
+
|
17 |
st.set_page_config(
|
18 |
page_title="Smart Farming Sentiment Analysis",
|
19 |
page_icon="🌱",
|
20 |
layout="wide"
|
21 |
)
|
22 |
|
23 |
+
login(token = os.environ['hf_token'])
|
24 |
+
dataset = load_dataset("irfantea/collections", data_files='smartfarmingsentences.csv')
|
25 |
+
df = dataset.to_pandas()
|
26 |
+
print(df.head())
|
27 |
+
st.dataframe(df)
|
28 |
+
|
29 |
def set_cleantext(dataframe):
|
30 |
#Sentence less than 10 words
|
31 |
dataframe = dataframe[dataframe['sentences'].apply(lambda x: len(x.split()) >= 10)]
|