Spaces:
Runtime error
Runtime error
Commit
·
e68deab
1
Parent(s):
040c0c0
Update app.py
Browse files
app.py
CHANGED
@@ -19,16 +19,23 @@ negative_preds = grouped_predictions.get_group(0)
|
|
19 |
def article_selection(sentiment):
|
20 |
if sentiment == "Positive":
|
21 |
predictions = negative_preds
|
22 |
-
|
23 |
-
|
|
|
|
|
24 |
elif sentiment == "Negative":
|
25 |
predictions = negative_preds
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
28 |
else:
|
29 |
predictions = negative_preds
|
30 |
-
|
31 |
-
|
|
|
|
|
32 |
|
33 |
def thanks(url, sentiment):
|
34 |
thanks_text = "Thank you for making our model better!"
|
@@ -49,7 +56,7 @@ suggestion_demo = gr.Interface(
|
|
49 |
fn=article_selection,
|
50 |
title = 'Recommending News Articles',
|
51 |
inputs = gr.Dropdown(["Positive","Negative","Neutral"], label="What type of news articles would you like recommended?"),
|
52 |
-
outputs = gr.Textbox(label="Recommended News Articles",
|
53 |
description = description1
|
54 |
)
|
55 |
|
|
|
19 |
def article_selection(sentiment):
|
20 |
if sentiment == "Positive":
|
21 |
predictions = negative_preds
|
22 |
+
predictions_df_url0 = predictions['Url'].iloc[0]
|
23 |
+
predictions_df_url1 = predictions['Url'].iloc[1]
|
24 |
+
predictions_df_url2 = predictions['Url'].iloc[2]
|
25 |
+
return predictions_df_url0, predictions_df_url1, predictions_df_url2
|
26 |
elif sentiment == "Negative":
|
27 |
predictions = negative_preds
|
28 |
+
predictions_df_url0 = predictions['Url'].iloc[0]
|
29 |
+
predictions_df_url1 = predictions['Url'].iloc[1]
|
30 |
+
predictions_df_url2 = predictions['Url'].iloc[2]
|
31 |
+
return predictions_df_url0, predictions_df_url1, predictions_df_url2
|
32 |
+
|
33 |
else:
|
34 |
predictions = negative_preds
|
35 |
+
predictions_df_url0 = predictions['Url'].iloc[0]
|
36 |
+
predictions_df_url1 = predictions['Url'].iloc[1]
|
37 |
+
predictions_df_url2 = predictions['Url'].iloc[2]
|
38 |
+
return predictions_df_url0, predictions_df_url1, predictions_df_url2
|
39 |
|
40 |
def thanks(url, sentiment):
|
41 |
thanks_text = "Thank you for making our model better!"
|
|
|
56 |
fn=article_selection,
|
57 |
title = 'Recommending News Articles',
|
58 |
inputs = gr.Dropdown(["Positive","Negative","Neutral"], label="What type of news articles would you like recommended?"),
|
59 |
+
outputs = [gr.Textbox(label="Recommended News Articles"),gr.Textbox(),gr.Textbox()]
|
60 |
description = description1
|
61 |
)
|
62 |
|