Spaces:
Sleeping
Sleeping
remove header from pdf_text before checking for quotes
Browse files
app.py
CHANGED
@@ -22,12 +22,15 @@ anthropic_api_key = os.environ["ANTHROPIC_API_KEY"]
|
|
22 |
client_anthropic = Anthropic(api_key=anthropic_api_key)
|
23 |
|
24 |
def parse_quotes(input_string, pdf_text):
|
|
|
|
|
|
|
25 |
# Find all matches of <quote>...</quote> and extract the content between the tags
|
26 |
matches = re.findall(r'<quote>(.*?)</quote>', input_string)
|
27 |
|
28 |
count = len(matches)
|
29 |
extracted_texts = matches
|
30 |
-
match_count = sum(1 for text in extracted_texts if text in
|
31 |
|
32 |
return count, match_count
|
33 |
|
@@ -503,7 +506,7 @@ if user_input:
|
|
503 |
# Column 4: Display revised feedback (from critic)
|
504 |
with col4:
|
505 |
st.subheader('Revised Feedback')
|
506 |
-
st.write(f"Quotes found verbatim in pdf text: {match_count}/{count}")
|
507 |
st.write(revised_feedback)
|
508 |
else:
|
509 |
|
@@ -527,7 +530,7 @@ if user_input:
|
|
527 |
# Column 3: Display revised feedback (from critic)
|
528 |
with col3:
|
529 |
st.subheader('Revised Feedback')
|
530 |
-
st.write(f"Quotes found verbatim in pdf text: {match_count}/{count}")
|
531 |
st.write(revised_feedback)
|
532 |
|
533 |
else:
|
|
|
22 |
client_anthropic = Anthropic(api_key=anthropic_api_key)
|
23 |
|
24 |
def parse_quotes(input_string, pdf_text):
|
25 |
+
|
26 |
+
pdf_text_wo_header = re.sub(r'(?m)^Under review as a conference paper at ICLR 2024*$', '', pdf_text)
|
27 |
+
|
28 |
# Find all matches of <quote>...</quote> and extract the content between the tags
|
29 |
matches = re.findall(r'<quote>(.*?)</quote>', input_string)
|
30 |
|
31 |
count = len(matches)
|
32 |
extracted_texts = matches
|
33 |
+
match_count = sum(1 for text in extracted_texts if text in pdf_text_wo_header)
|
34 |
|
35 |
return count, match_count
|
36 |
|
|
|
506 |
# Column 4: Display revised feedback (from critic)
|
507 |
with col4:
|
508 |
st.subheader('Revised Feedback')
|
509 |
+
if count > 0: st.write(f"Quotes found verbatim in pdf text: {match_count}/{count}")
|
510 |
st.write(revised_feedback)
|
511 |
else:
|
512 |
|
|
|
530 |
# Column 3: Display revised feedback (from critic)
|
531 |
with col3:
|
532 |
st.subheader('Revised Feedback')
|
533 |
+
if count > 0: st.write(f"Quotes found verbatim in pdf text: {match_count}/{count}")
|
534 |
st.write(revised_feedback)
|
535 |
|
536 |
else:
|