Spaces:
Running
Running
update
Browse files
app.py
CHANGED
@@ -10,13 +10,18 @@ st.subheader("Search for News and classify the headlines with sentiment analysis
|
|
10 |
|
11 |
query = st.text_input("Enter Query")
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
settings = {
|
14 |
"lang": "fr",
|
15 |
"region": "FR",
|
16 |
-
"period": "1d"
|
|
|
17 |
}
|
18 |
|
19 |
-
classifier = pipeline(task="text-classification", model="SamLowe/roberta-base-go_emotions", top_k=None)
|
20 |
|
21 |
with st.sidebar:
|
22 |
st.title("Settings")
|
@@ -28,13 +33,15 @@ with st.sidebar:
|
|
28 |
# add period parameter
|
29 |
st.header("Period")
|
30 |
settings["period"] = st.selectbox("Select Period", ["1d", "7", "30d"])
|
31 |
-
|
32 |
-
|
|
|
33 |
|
34 |
|
35 |
if st.button("Search"):
|
|
|
36 |
df = wna.get_news(settings, query)
|
37 |
-
st.dataframe(df)
|
38 |
# get each title colums
|
39 |
sentences = df["title"]
|
40 |
# convert into array
|
|
|
10 |
|
11 |
query = st.text_input("Enter Query")
|
12 |
|
13 |
+
models = [
|
14 |
+
"SamLowe/roberta-base-go_emotions",
|
15 |
+
# "distilbert/distilbert-base-uncased-finetuned-sst-2-english"
|
16 |
+
]
|
17 |
+
|
18 |
settings = {
|
19 |
"lang": "fr",
|
20 |
"region": "FR",
|
21 |
+
"period": "1d",
|
22 |
+
"model": models[0],
|
23 |
}
|
24 |
|
|
|
25 |
|
26 |
with st.sidebar:
|
27 |
st.title("Settings")
|
|
|
33 |
# add period parameter
|
34 |
st.header("Period")
|
35 |
settings["period"] = st.selectbox("Select Period", ["1d", "7", "30d"])
|
36 |
+
# Add models parameters
|
37 |
+
st.header("Models")
|
38 |
+
settings["model"] = st.selectbox("Select Model", models)
|
39 |
|
40 |
|
41 |
if st.button("Search"):
|
42 |
+
classifier = pipeline(task="text-classification", model=settings["model"], top_k=None)
|
43 |
df = wna.get_news(settings, query)
|
44 |
+
# st.dataframe(df)
|
45 |
# get each title colums
|
46 |
sentences = df["title"]
|
47 |
# convert into array
|