iframe load from url instead of base64
Browse files
app.py
CHANGED
|
@@ -57,7 +57,7 @@ def evaluate_applicants(
|
|
| 57 |
job_annotation["job"]["annotation"]
|
| 58 |
)
|
| 59 |
evaluation = json.loads(res["evaluation"])
|
| 60 |
-
cv_base64 = cv_processor.encode_base64(cv_file.name)
|
| 61 |
|
| 62 |
score = float(evaluation["match_score"])
|
| 63 |
if score >= 0.8:
|
|
@@ -72,7 +72,8 @@ def evaluate_applicants(
|
|
| 72 |
"Match Score": evaluation["match_score"],
|
| 73 |
"Match Labels": match_labels,
|
| 74 |
"Match Reasoning": evaluation["match_reasoning"],
|
| 75 |
-
"CV Base64": cv_base64,
|
|
|
|
| 76 |
}
|
| 77 |
)
|
| 78 |
#logger.info(f"Evaluation results: {response}")
|
|
@@ -93,8 +94,9 @@ def df_select_callback(df: pd.DataFrame, evt: gr.SelectData):
|
|
| 93 |
match_labels = selected_row[2] # .get('Match Labels', 'N/A')
|
| 94 |
match_reasoning = selected_row[3] # .get('Match Reasoning', 'N/A')
|
| 95 |
|
| 96 |
-
cv_base64 = selected_row[4] # .get('CV Base64', '')
|
| 97 |
-
|
|
|
|
| 98 |
pdf_encoded = gr.HTML(
|
| 99 |
"""
|
| 100 |
<!-- The Modal -->
|
|
@@ -109,8 +111,9 @@ def df_select_callback(df: pd.DataFrame, evt: gr.SelectData):
|
|
| 109 |
<div class="modal-body">
|
| 110 |
|
| 111 |
<div id="my-pdf" class="pdfobject-container" style="height: 100%">
|
| 112 |
-
<
|
| 113 |
-
|
|
|
|
| 114 |
</div>
|
| 115 |
</div>
|
| 116 |
<div class="modal-footer">
|
|
@@ -121,7 +124,7 @@ def df_select_callback(df: pd.DataFrame, evt: gr.SelectData):
|
|
| 121 |
</div>
|
| 122 |
|
| 123 |
""".format(
|
| 124 |
-
title=selected_row[0],
|
| 125 |
),
|
| 126 |
label="CV PDF Viewer",
|
| 127 |
elem_id="pdf_viewer",
|
|
|
|
| 57 |
job_annotation["job"]["annotation"]
|
| 58 |
)
|
| 59 |
evaluation = json.loads(res["evaluation"])
|
| 60 |
+
#cv_base64 = cv_processor.encode_base64(cv_file.name)
|
| 61 |
|
| 62 |
score = float(evaluation["match_score"])
|
| 63 |
if score >= 0.8:
|
|
|
|
| 72 |
"Match Score": evaluation["match_score"],
|
| 73 |
"Match Labels": match_labels,
|
| 74 |
"Match Reasoning": evaluation["match_reasoning"],
|
| 75 |
+
#"CV Base64": cv_base64,
|
| 76 |
+
"CV Url": f"gradio_api/file={cv_file.name}"
|
| 77 |
}
|
| 78 |
)
|
| 79 |
#logger.info(f"Evaluation results: {response}")
|
|
|
|
| 94 |
match_labels = selected_row[2] # .get('Match Labels', 'N/A')
|
| 95 |
match_reasoning = selected_row[3] # .get('Match Reasoning', 'N/A')
|
| 96 |
|
| 97 |
+
# cv_base64 = selected_row[4] # .get('CV Base64', '')
|
| 98 |
+
pdf_url = selected_row[4] # .get('CV Url', '')
|
| 99 |
+
if pdf_url:
|
| 100 |
pdf_encoded = gr.HTML(
|
| 101 |
"""
|
| 102 |
<!-- The Modal -->
|
|
|
|
| 111 |
<div class="modal-body">
|
| 112 |
|
| 113 |
<div id="my-pdf" class="pdfobject-container" style="height: 100%">
|
| 114 |
+
<iframe title="{title}" src="{pdf_url}" type="application/pdf" width="100%" height="100%" sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-modals">
|
| 115 |
+
<p>This browser does not support PDFs. Please download the PDF to view it: <a href="{pdf_url}">Download PDF</a>.</p>
|
| 116 |
+
</iframe>
|
| 117 |
</div>
|
| 118 |
</div>
|
| 119 |
<div class="modal-footer">
|
|
|
|
| 124 |
</div>
|
| 125 |
|
| 126 |
""".format(
|
| 127 |
+
title=selected_row[0], pdf_url=pdf_url
|
| 128 |
),
|
| 129 |
label="CV PDF Viewer",
|
| 130 |
elem_id="pdf_viewer",
|