Spaces:
Runtime error
Runtime error
Commit
·
e93fd31
1
Parent(s):
a3435d2
Update app.py
Browse files
app.py
CHANGED
@@ -22,9 +22,12 @@ def article_selection(sentiment):
|
|
22 |
if sentiment == "Positive":
|
23 |
predictions = negative_preds
|
24 |
predictions_df_url0 = predictions['Url'].iloc[0]
|
|
|
25 |
predictions_df_url1 = predictions['Url'].iloc[1]
|
|
|
26 |
predictions_df_url2 = predictions['Url'].iloc[2]
|
27 |
-
|
|
|
28 |
elif sentiment == "Negative":
|
29 |
predictions = negative_preds
|
30 |
predictions_df_url0 = predictions['Url'].iloc[0]
|
@@ -63,7 +66,8 @@ suggestion_demo = gr.Interface(
|
|
63 |
fn=article_selection,
|
64 |
title = 'Recommending News Articles',
|
65 |
inputs = gr.Dropdown(["Positive","Negative","Neutral"], label="What type of news articles would you like recommended?"),
|
66 |
-
outputs =
|
|
|
67 |
description = description1
|
68 |
)
|
69 |
|
|
|
22 |
if sentiment == "Positive":
|
23 |
predictions = negative_preds
|
24 |
predictions_df_url0 = predictions['Url'].iloc[0]
|
25 |
+
predictions_df_head0 = predictions['Headlines_string'].iloc[0]
|
26 |
predictions_df_url1 = predictions['Url'].iloc[1]
|
27 |
+
predictions_df_head1 = predictions['Headlines_string'].iloc[1]
|
28 |
predictions_df_url2 = predictions['Url'].iloc[2]
|
29 |
+
predictions_df_head2 = predictions['Headlines_string'].iloc[2]
|
30 |
+
return [[predictions_df_head0 predictions_df_url0], [predictions_df_head1 predictions_df_url1], [predictions_df_head2 predictions_df_url2]
|
31 |
elif sentiment == "Negative":
|
32 |
predictions = negative_preds
|
33 |
predictions_df_url0 = predictions['Url'].iloc[0]
|
|
|
66 |
fn=article_selection,
|
67 |
title = 'Recommending News Articles',
|
68 |
inputs = gr.Dropdown(["Positive","Negative","Neutral"], label="What type of news articles would you like recommended?"),
|
69 |
+
outputs = "dataframe",
|
70 |
+
#outputs = [gr.Textbox(label="Recommended News Articles (1/3)"),gr.Textbox(label="Recommended News Articles (2/3)"),gr.Textbox(label="Recommended News Articles (3/3)")],
|
71 |
description = description1
|
72 |
)
|
73 |
|