Spaces:
Sleeping
Sleeping
Commit
Β·
d210108
1
Parent(s):
8dca04f
Add system
Browse files- app.py +5 -0
- system/augmented_searching.py +2 -2
- system/pledge_tracking.py +2 -1
app.py
CHANGED
@@ -183,6 +183,11 @@ def run_model():
|
|
183 |
with open(default_log_path, "w") as f:
|
184 |
f.write(json.dumps(log_entry, indent=1))
|
185 |
|
|
|
|
|
|
|
|
|
|
|
186 |
try:
|
187 |
api = HfApi()
|
188 |
api.upload_file(
|
|
|
183 |
with open(default_log_path, "w") as f:
|
184 |
f.write(json.dumps(log_entry, indent=1))
|
185 |
|
186 |
+
default_tsv_path = f"{FEEDBACK_DIR}/augmented_{timestamp}_{user_id}.tsv"
|
187 |
+
tsv_path = outputs["sorted_events"]
|
188 |
+
df = pd.read_excel(tsv_path)
|
189 |
+
df.to_csv(default_tsv_path, sep='\t', index=False)
|
190 |
+
|
191 |
try:
|
192 |
api = HfApi()
|
193 |
api.upload_file(
|
system/augmented_searching.py
CHANGED
@@ -45,11 +45,11 @@ def ensure_directory_exists(path):
|
|
45 |
raise ValueError(f"[ERROR] Unsafe path: {dir_path}")
|
46 |
dir_path.mkdir(parents=True, exist_ok=True)
|
47 |
|
48 |
-
def run_augmented_searching(qa_file, pipeline_base_dir, suggestion_meta, pledge_author, start_date, end_date):
|
49 |
if suggestion_meta==None:
|
50 |
qa_lines = open(f"{qa_file}","r").read()
|
51 |
qa_lines = json.loads(qa_lines)
|
52 |
-
claim_text = f"{pledge_author}: {qa_lines['claim']}"
|
53 |
idx=0
|
54 |
else:
|
55 |
# claim_text = suggestion_meta["text"]
|
|
|
45 |
raise ValueError(f"[ERROR] Unsafe path: {dir_path}")
|
46 |
dir_path.mkdir(parents=True, exist_ok=True)
|
47 |
|
48 |
+
def run_augmented_searching(qa_file, pipeline_base_dir, suggestion_meta, pledge_author, pledge_date, start_date, end_date):
|
49 |
if suggestion_meta==None:
|
50 |
qa_lines = open(f"{qa_file}","r").read()
|
51 |
qa_lines = json.loads(qa_lines)
|
52 |
+
claim_text = f"{pledge_author}: {qa_lines['claim']} ({pledge_date})"
|
53 |
idx=0
|
54 |
else:
|
55 |
# claim_text = suggestion_meta["text"]
|
system/pledge_tracking.py
CHANGED
@@ -46,7 +46,7 @@ def run_pipeline(claim, pledge_date, pledge_author, start_date, timestamp, user_
|
|
46 |
|
47 |
print("π Step 1: Initial searching ...")
|
48 |
initial_tsv_file, claim_json_path = run_initial_searching(
|
49 |
-
claim_text=f"{pledge_author} : {claim}",
|
50 |
# pledge_author=pledge_author,
|
51 |
pipeline_base_dir=pipeline_base_dir,
|
52 |
start_date=start_date,
|
@@ -123,6 +123,7 @@ def run_pipeline(claim, pledge_date, pledge_author, start_date, timestamp, user_
|
|
123 |
augmented_tsv_file = run_augmented_searching(
|
124 |
qa_file=qa_file_path,
|
125 |
pledge_author=pledge_author,
|
|
|
126 |
pipeline_base_dir=pipeline_base_dir,
|
127 |
start_date=start_date,
|
128 |
suggestion_meta=suggestion_meta,
|
|
|
46 |
|
47 |
print("π Step 1: Initial searching ...")
|
48 |
initial_tsv_file, claim_json_path = run_initial_searching(
|
49 |
+
claim_text=f"{pledge_author} : {claim} ({pledge_date})",
|
50 |
# pledge_author=pledge_author,
|
51 |
pipeline_base_dir=pipeline_base_dir,
|
52 |
start_date=start_date,
|
|
|
123 |
augmented_tsv_file = run_augmented_searching(
|
124 |
qa_file=qa_file_path,
|
125 |
pledge_author=pledge_author,
|
126 |
+
pledge_date=pledge_date,
|
127 |
pipeline_base_dir=pipeline_base_dir,
|
128 |
start_date=start_date,
|
129 |
suggestion_meta=suggestion_meta,
|