torileatherman commited on
Commit
378829d
·
1 Parent(s): 668e514

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import gradio as gr
2
  import hopsworks
3
  from datasets import load_dataset
4
- import numpy as np
5
  import pandas as pd
6
 
7
  project = hopsworks.login()
@@ -9,9 +8,8 @@ fs = project.get_feature_store()
9
 
10
  dataset_api = project.get_dataset_api()
11
 
12
- dataset_api.download("Resources/batch_data_predictions.csv")
13
- dataset = load_dataset("csv", data_files="batch_data_predictions.csv")
14
- predictions_df = pd.DataFrame(dataset,columns=['Headlines', 'URL','Predictions'],)
15
  predictions_df_url0 = predictions_df['URL'].iloc[1]
16
  predictions_df_url1 = predictions_df['URL'].iloc[2]
17
  predictions_df_url2 = predictions_df['URL'].iloc[3]
@@ -21,10 +19,10 @@ predictions_df_url2 = predictions_df['URL'].iloc[3]
21
  def article_selection(sentiment):
22
  if sentiment == "Positive":
23
  return predictions_df_url0, predictions_df_url1, predictions_df_url2 #f"""The sentence you requested is Positive!"""
24
- #elif sentiment == "Negative":
25
- # return f"""The sentence you requested is Negative!"""
26
- #else:
27
- # return f"""The sentence you requested is Neutral!"""
28
 
29
 
30
 
 
1
  import gradio as gr
2
  import hopsworks
3
  from datasets import load_dataset
 
4
  import pandas as pd
5
 
6
  project = hopsworks.login()
 
8
 
9
  dataset_api = project.get_dataset_api()
10
 
11
+ dataset = load_dataset("torileatherman/sentiment_analysis_batch_predictions")
12
+ predictions_df = pd.DataFrame(dataset,columns=['Headlines_seq', 'URL','Headline_str','Predictions'])
 
13
  predictions_df_url0 = predictions_df['URL'].iloc[1]
14
  predictions_df_url1 = predictions_df['URL'].iloc[2]
15
  predictions_df_url2 = predictions_df['URL'].iloc[3]
 
19
  def article_selection(sentiment):
20
  if sentiment == "Positive":
21
  return predictions_df_url0, predictions_df_url1, predictions_df_url2 #f"""The sentence you requested is Positive!"""
22
+ elif sentiment == "Negative":
23
+ return f"""The sentence you requested is Negative!"""
24
+ else:
25
+ return f"""The sentence you requested is Neutral!"""
26
 
27
 
28