SelmaNajih001 commited on
Commit
1264177
·
verified ·
1 Parent(s): b08e4c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -1040,7 +1040,7 @@ for i, row in df_multi.iterrows():
1040
 
1041
  # Sentiment for all companies
1042
  try:
1043
- res = sentiment_pipeline(row['Riassunto'])[0]
1044
  df_multi.at[i,'Sentiment'] = res['label'].upper().strip()
1045
  df_multi.at[i,'Confidence'] = res['score']
1046
  except:
@@ -1146,16 +1146,17 @@ def show_company_data(selected_companies):
1146
  demo = gr.Interface(
1147
  fn=show_company_data,
1148
  inputs=[
1149
- gr.CheckboxGroup(
1150
- choices=companies,
1151
- value=["Microsoft", "Tesla,Inc."], # <- default pre-selezionate
1152
- label="Select Companies"
 
 
1153
  )
1154
  ],
1155
  outputs=[
1156
  gr.Dataframe(label="Top 10 Rows per Company", type="pandas"),
1157
  gr.Plot(label="Strategy A: Sentiment"),
1158
- # gr.Plot(label="Strategy B: Regression")
1159
  ],
1160
  title="Interactive Portfolio Evolution",
1161
  description="Select one or more companies to visualize portfolio evolution based on the sentiment of the news."
 
1040
 
1041
  # Sentiment for all companies
1042
  try:
1043
+ res = sentiment_pipeline(row['Summary'])[0]
1044
  df_multi.at[i,'Sentiment'] = res['label'].upper().strip()
1045
  df_multi.at[i,'Confidence'] = res['score']
1046
  except:
 
1146
  demo = gr.Interface(
1147
  fn=show_company_data,
1148
  inputs=[
1149
+ gr.Dropdown(
1150
+ choices=companies,
1151
+ value=["Microsoft"], # default
1152
+ label="Select Companies",
1153
+ multiselect=True, # permette selezione multipla
1154
+ searchable=True # abilita la ricerca testuale
1155
  )
1156
  ],
1157
  outputs=[
1158
  gr.Dataframe(label="Top 10 Rows per Company", type="pandas"),
1159
  gr.Plot(label="Strategy A: Sentiment"),
 
1160
  ],
1161
  title="Interactive Portfolio Evolution",
1162
  description="Select one or more companies to visualize portfolio evolution based on the sentiment of the news."