torileatherman commited on
Commit
a401c4a
1 Parent(s): dfeb77c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -38,7 +38,7 @@ def article_selection(sentiment):
38
  def manual_label():
39
  # Selecting random row from batch data
40
  random_sample = predictions_df.sample()
41
- random_sample.to_csv('/Users/torileatherman/Github/ID2223_scalable_machine_learning/news_articles_sentiment/', index=False)
42
  random_headline = random_sample['Headline_string'].iloc[0]
43
  random_prediction = random_sample['Prediction'].iloc[0]
44
  return random_headline, random_prediction
@@ -47,13 +47,14 @@ def manual_label():
47
  def thanks(sentiment):
48
  labeled_sentiments = []
49
  labeled_sentiments.append(sentiment)
50
- counter = len(labeled_sentiments)
51
- counter = str(counter)
52
- login(token = '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')
53
- create_repo("torileatherman/"+counter+"labeled_data")
54
- labeled_sentiments = pd.DataFrame(labeled_sentiments, columns = ['Predictions'])
55
- labeled_sentiments = Dataset.from_pandas(labeled_sentiments)
56
- labeled_sentiments.push_to_hub("torileatherman/"+counter+"labeled_data")
 
57
  return f"""Thank you for making our model better!"""
58
 
59
 
 
38
  def manual_label():
39
  # Selecting random row from batch data
40
  random_sample = predictions_df.sample()
41
+ random_sample.to_csv('/Users/torileatherman/Github/ID2223_scalable_machine_learning/news_articles_sentiment/sample.csv', index=False)
42
  random_headline = random_sample['Headline_string'].iloc[0]
43
  random_prediction = random_sample['Prediction'].iloc[0]
44
  return random_headline, random_prediction
 
47
  def thanks(sentiment):
48
  labeled_sentiments = []
49
  labeled_sentiments.append(sentiment)
50
+ #counter = len(labeled_sentiments)
51
+ #counter = str(counter)
52
+ #login(token = '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')
53
+ #create_repo("torileatherman/"+counter+"labeled_data")
54
+ labeled_sentiments = pd.DataFrame(labeled_sentiments, columns = ['Manual Predictions'])
55
+ labeled_sentiments.to_csv('/Users/torileatherman/Github/ID2223_scalable_machine_learning/news_articles_sentiment/manual_labels.csv', index=False)
56
+ #labeled_sentiments = Dataset.from_pandas(labeled_sentiments)
57
+ #labeled_sentiments.push_to_hub("torileatherman/"+counter+"labeled_data")
58
  return f"""Thank you for making our model better!"""
59
 
60