Spaces:
Sleeping
Sleeping
Feat: Add password
Browse files- _annotations.csv +0 -5
- annotations.csv +0 -2
- app.py +29 -24
- io_annotations.csv +0 -3
- kkk_annotations.csv +0 -3
- ssddsd_annotations.csv +0 -2
- tt_annotations.csv +0 -4
- yguygyguyg_annotations.csv +0 -11
_annotations.csv
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
sample_id,sentence,emotion,confidence,comments
|
| 2 |
-
007-0023,I was mostly hanging out in East Village in the clubs.,Neutral,50,
|
| 3 |
-
007-0034,"And we became friends, and then he told me that his lover had died of AIDS.",Angry,0,
|
| 4 |
-
007-0086,"I mean, given the size of ACT UP, I mean, really, you're talking about a handful.",Neutral,0,
|
| 5 |
-
007-0129,"And why is he like, you know, why are you putting him in yellow face?",Angry,0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
annotations.csv
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
sample_id,sentence,emotion,confidence,comments
|
| 2 |
-
007-0023,I was mostly hanging out in East Village in the clubs.,Neutral,0,
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import pandas as pd
|
|
| 3 |
import os
|
| 4 |
import gradio as gr
|
| 5 |
from pathlib import Path
|
|
|
|
| 6 |
|
| 7 |
css = """#myProgress {
|
| 8 |
width: 100%;
|
|
@@ -214,24 +215,26 @@ total_annotations = len(file_list)
|
|
| 214 |
# Initialize an empty DataFrame to store annotations
|
| 215 |
annotations = pd.DataFrame(columns=['sample_id', 'sentence', 'emotion', 'confidence', 'comments'])
|
| 216 |
current_index = {"index": 0} # Dictionary to allow modifying inside functions
|
|
|
|
| 217 |
|
| 218 |
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
def get_storage():
|
| 222 |
#source: https://discuss.huggingface.co/t/accessing-data-folder-of-persistent-storage/46681/2
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
|
|
|
|
|
|
|
|
|
| 235 |
return files, f"{usage/(1024.0 ** 3):.3f}GB"
|
| 236 |
|
| 237 |
|
|
@@ -421,15 +424,17 @@ with (gr.Blocks(theme=gr.themes.Soft(), css = css) as demo):
|
|
| 421 |
lets_go.click(load_first_example, inputs = [gr.Number(current_index["index"], visible = False), participant_id, ann_completed], outputs = [ann_completed, sentence_text, audio_player, emotions, confidence, ann_completed, comments]).then( None, [], [ann_completed, total], js = js_progress_bar)
|
| 422 |
#lets_go.click(None, [], [ann_completed, total], js = js_progress_bar)
|
| 423 |
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
|
|
|
|
|
|
| 433 |
|
| 434 |
demo.launch()
|
| 435 |
|
|
|
|
| 3 |
import os
|
| 4 |
import gradio as gr
|
| 5 |
from pathlib import Path
|
| 6 |
+
from huggingface_hub import login
|
| 7 |
|
| 8 |
css = """#myProgress {
|
| 9 |
width: 100%;
|
|
|
|
| 215 |
# Initialize an empty DataFrame to store annotations
|
| 216 |
annotations = pd.DataFrame(columns=['sample_id', 'sentence', 'emotion', 'confidence', 'comments'])
|
| 217 |
current_index = {"index": 0} # Dictionary to allow modifying inside functions
|
| 218 |
+
password_files = os.getenv("password_files")
|
| 219 |
|
| 220 |
|
| 221 |
+
def get_storage(password):
|
|
|
|
|
|
|
| 222 |
#source: https://discuss.huggingface.co/t/accessing-data-folder-of-persistent-storage/46681/2
|
| 223 |
+
if password == password_files:
|
| 224 |
+
files = [
|
| 225 |
+
{
|
| 226 |
+
"orig_name": file.name,
|
| 227 |
+
"name": file.resolve(),
|
| 228 |
+
"size": file.stat().st_size,
|
| 229 |
+
"data": None,
|
| 230 |
+
"is_file": True,
|
| 231 |
+
}
|
| 232 |
+
for file in persistent_storage.glob("**/*.csv")
|
| 233 |
+
if file.is_file()
|
| 234 |
+
]
|
| 235 |
+
usage = sum([f['size'] for f in files])
|
| 236 |
+
else:
|
| 237 |
+
gr.Warning("Please provide the correct password")
|
| 238 |
return files, f"{usage/(1024.0 ** 3):.3f}GB"
|
| 239 |
|
| 240 |
|
|
|
|
| 424 |
lets_go.click(load_first_example, inputs = [gr.Number(current_index["index"], visible = False), participant_id, ann_completed], outputs = [ann_completed, sentence_text, audio_player, emotions, confidence, ann_completed, comments]).then( None, [], [ann_completed, total], js = js_progress_bar)
|
| 425 |
#lets_go.click(None, [], [ann_completed, total], js = js_progress_bar)
|
| 426 |
|
| 427 |
+
with gr.Tab("Access Files"):
|
| 428 |
+
with gr.Row():
|
| 429 |
+
with gr.Column():
|
| 430 |
+
password = gr.Textbox(label='Password', interactive = True)
|
| 431 |
+
get_files_button = gr.Button("Get Files")
|
| 432 |
+
|
| 433 |
+
with gr.Column():
|
| 434 |
+
files = gr.Files(label="Files")
|
| 435 |
+
storage = gr.Text(label="Total Usage")
|
| 436 |
+
get_files_button.click(get_storage, inputs= [password], outputs=[files, storage], postprocess=False)
|
| 437 |
+
|
| 438 |
|
| 439 |
demo.launch()
|
| 440 |
|
io_annotations.csv
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
sample_id,sentence,emotion,confidence,comments
|
| 2 |
-
007-0023,I was mostly hanging out in East Village in the clubs.,Neutral,0,
|
| 3 |
-
007-0034,"And we became friends, and then he told me that his lover had died of AIDS.",Neutral,0,
|
|
|
|
|
|
|
|
|
|
|
|
kkk_annotations.csv
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
sample_id,sentence,emotion,confidence,comments
|
| 2 |
-
007-0023,I was mostly hanging out in East Village in the clubs.,Neutral,0,
|
| 3 |
-
007-0034,"And we became friends, and then he told me that his lover had died of AIDS.",Neutral,0,
|
|
|
|
|
|
|
|
|
|
|
|
ssddsd_annotations.csv
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
sample_id,sentence,emotion,confidence,comments
|
| 2 |
-
007-0023,I was mostly hanging out in East Village in the clubs.,Angry,20,sdasdasd
|
|
|
|
|
|
|
|
|
tt_annotations.csv
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
sample_id,sentence,emotion,confidence,comments
|
| 2 |
-
007-0023,I was mostly hanging out in East Village in the clubs.,Joy,0,
|
| 3 |
-
007-0034,"And we became friends, and then he told me that his lover had died of AIDS.",Sad,0,
|
| 4 |
-
007-0086,"I mean, given the size of ACT UP, I mean, really, you're talking about a handful.",Neutral,0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
yguygyguyg_annotations.csv
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
sample_id,sentence,emotion,confidence,comments
|
| 2 |
-
007-0023,I was mostly hanging out in East Village in the clubs.,Sad,0,huihi
|
| 3 |
-
007-0034,"And we became friends, and then he told me that his lover had died of AIDS.",Angry,0,
|
| 4 |
-
007-0086,"I mean, given the size of ACT UP, I mean, really, you're talking about a handful.",Angry,0,
|
| 5 |
-
007-0129,"And why is he like, you know, why are you putting him in yellow face?",Neutral,0,
|
| 6 |
-
007-0152,"But what was really amazing was that this was really one of the first grassroots protest movements that was spearheaded by lesbian, gay, Asian, Pacific Islanders.",Neutral,0,
|
| 7 |
-
007-0165,"We had a couple of people, like, you know, some people come and go.",Neutral,0,
|
| 8 |
-
007-0174,"And then to be approached by these crazy Asian actors, I think that might be a little much.",Neutral,0,
|
| 9 |
-
007-0248,"And again, you're talking about this community that's sort of really just starting to come up.",Angry,0,
|
| 10 |
-
007-0444,"I mean, they're friendly to you. There's a camaraderie, definitely.",Sad,0,
|
| 11 |
-
008-0016,"My other feminist friends, and we were a little clique.",Sad,0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|