Spaces:
Starting
on
A100
Starting
on
A100
Commit
·
602a998
1
Parent(s):
e30c3ac
Add system
Browse files- system/augmented_searching.py +2 -2
- system/pledge_tracking.py +7 -5
- test.html +1 -1
system/augmented_searching.py
CHANGED
@@ -45,7 +45,7 @@ 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)
|
@@ -95,5 +95,5 @@ def run_augmented_searching(qa_file, pipeline_base_dir, suggestion_meta, pledge_
|
|
95 |
urls = list(dict.fromkeys(urls))
|
96 |
|
97 |
save_tsv(str(tsv_file_path), [0] * len(urls), string_values, urls, queries)
|
98 |
-
print(f"[SYSTEM] Saved {len(urls)} URLs for claim {
|
99 |
return str(tsv_file_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)
|
|
|
95 |
urls = list(dict.fromkeys(urls))
|
96 |
|
97 |
save_tsv(str(tsv_file_path), [0] * len(urls), string_values, urls, queries)
|
98 |
+
print(f"[SYSTEM] Saved {len(urls)} URLs for claim {idx} to {tsv_file_path}")
|
99 |
return str(tsv_file_path)
|
system/pledge_tracking.py
CHANGED
@@ -104,9 +104,10 @@ def run_pipeline(claim, pledge_date, pledge_author, start_date, timestamp, user_
|
|
104 |
repo_type="dataset",
|
105 |
token=os.environ["HF_TOKEN"]
|
106 |
)
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
110 |
if update_fn:
|
111 |
update_fn(step_id, f"relevant queries are generated, for example:\n"
|
112 |
f"{questions[0]}\n"
|
@@ -124,9 +125,10 @@ def run_pipeline(claim, pledge_date, pledge_author, start_date, timestamp, user_
|
|
124 |
start_date=start_date,
|
125 |
suggestion_meta=suggestion_meta,
|
126 |
end_date="",
|
127 |
-
user_id=user_id,
|
128 |
-
claim_id=0,
|
129 |
)
|
|
|
|
|
|
|
130 |
with open(augmented_tsv_file, "r", encoding="utf-8") as f:
|
131 |
line_count = sum(1 for line in f)
|
132 |
if update_fn:
|
|
|
104 |
repo_type="dataset",
|
105 |
token=os.environ["HF_TOKEN"]
|
106 |
)
|
107 |
+
idx = suggestion_meta["index"]
|
108 |
+
qa_lines = open(f"{qa_file_path}","r").readlines()[idx]
|
109 |
+
questions = {line["question"] for line in json.load(qa_lines)["evidence"]}
|
110 |
+
line_count = len(questions)
|
111 |
if update_fn:
|
112 |
update_fn(step_id, f"relevant queries are generated, for example:\n"
|
113 |
f"{questions[0]}\n"
|
|
|
125 |
start_date=start_date,
|
126 |
suggestion_meta=suggestion_meta,
|
127 |
end_date="",
|
|
|
|
|
128 |
)
|
129 |
+
|
130 |
+
|
131 |
+
|
132 |
with open(augmented_tsv_file, "r", encoding="utf-8") as f:
|
133 |
line_count = sum(1 for line in f)
|
134 |
if update_fn:
|
test.html
CHANGED
@@ -387,7 +387,7 @@
|
|
387 |
const author = "Labour";
|
388 |
const date = "2024-07-04";
|
389 |
suggestionBox.innerHTML =
|
390 |
-
"<div class='font-semibold mb-1'>💡 Are you fact-checking
|
391 |
"<ul class='list-disc ml-6 mt-1'>" +
|
392 |
suggestions.map(s => `
|
393 |
<li class="mb-2">
|
|
|
387 |
const author = "Labour";
|
388 |
const date = "2024-07-04";
|
389 |
suggestionBox.innerHTML =
|
390 |
+
"<div class='font-semibold mb-1'>💡 Are you fact-checking this pledge? </div>" +
|
391 |
"<ul class='list-disc ml-6 mt-1'>" +
|
392 |
suggestions.map(s => `
|
393 |
<li class="mb-2">
|