Spaces:
Runtime error
Runtime error
Commit
·
3d1b8c7
1
Parent(s):
7344b95
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
-
from datasets import load_dataset
|
3 |
import pandas as pd
|
4 |
from huggingface_hub import create_repo
|
5 |
from huggingface_hub import login
|
6 |
-
import os
|
7 |
-
login(token='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')
|
8 |
|
9 |
dataset = load_dataset("torileatherman/sentiment_analysis_batch_predictions", split='train')
|
10 |
predictions_df = pd.DataFrame(dataset)
|
@@ -44,13 +42,16 @@ def manual_label():
|
|
44 |
random_prediction = random_sample['Prediction'].iloc[0]
|
45 |
return random_headline, random_prediction
|
46 |
|
|
|
|
|
47 |
def thanks(sentiment):
|
48 |
labeled_sentiments = []
|
49 |
labeled_sentiments.append(sentiment)
|
50 |
counter = len(labeled_sentiments)
|
51 |
-
|
|
|
52 |
create_repo("torileatherman/"+counter+"labeled_data")
|
53 |
-
|
54 |
labeled_sentiments = Dataset.from_pandas(labeled_sentiments)
|
55 |
labeled_sentiments.push_to_hub("torileatherman/"+counter+"labeled_data")
|
56 |
return f"""Thank you for making our model better!"""
|
|
|
1 |
import gradio as gr
|
2 |
+
from datasets import load_dataset, Dataset
|
3 |
import pandas as pd
|
4 |
from huggingface_hub import create_repo
|
5 |
from huggingface_hub import login
|
|
|
|
|
6 |
|
7 |
dataset = load_dataset("torileatherman/sentiment_analysis_batch_predictions", split='train')
|
8 |
predictions_df = pd.DataFrame(dataset)
|
|
|
42 |
random_prediction = random_sample['Prediction'].iloc[0]
|
43 |
return random_headline, random_prediction
|
44 |
|
45 |
+
|
46 |
+
|
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!"""
|