Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from parser import parse_resume
|
|
|
|
| 3 |
|
| 4 |
def process_input(job_description, resumes):
|
| 5 |
# resumes = [r for r in resumes if r and r.strip() != ""] # Remove empty
|
|
@@ -9,6 +10,10 @@ def process_input(job_description, resumes):
|
|
| 9 |
print("[CATEGORIES]", resumes)
|
| 10 |
|
| 11 |
thinking, results = parse_resume(job_description, resumes)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
return thinking, results
|
| 13 |
|
| 14 |
# results = zip(*parse_resume(job_description, resumes))
|
|
@@ -109,8 +114,7 @@ with gr.Blocks() as demo:
|
|
| 109 |
|
| 110 |
delete_json_button = gr.Button("Delete Category")
|
| 111 |
|
| 112 |
-
|
| 113 |
-
json_display = gr.JSON(value=initial_parsing, label="Parsing Categories")
|
| 114 |
delete_json_button.click(delete_json, inputs=[json_display, category_delete], outputs=json_display)
|
| 115 |
job_description = gr.Textbox(
|
| 116 |
lines=8,
|
|
@@ -118,24 +122,25 @@ with gr.Blocks() as demo:
|
|
| 118 |
label="CV / Resume"
|
| 119 |
)
|
| 120 |
|
|
|
|
| 121 |
# output = gr.Textbox(
|
| 122 |
# lines=10,
|
| 123 |
# label="JSON Result",
|
| 124 |
# interactive=False
|
| 125 |
# )
|
| 126 |
-
output = gr.JSON(show_indices=True, label="Parsing Output")
|
| 127 |
thinking_output = gr.Textbox(
|
| 128 |
lines=10,
|
| 129 |
label="Thinking Result",
|
| 130 |
interactive=False
|
| 131 |
)
|
| 132 |
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
|
| 140 |
|
| 141 |
# add_resume_btn.click(add_resume, outputs=resumes_group)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from parser import parse_resume
|
| 3 |
+
import json
|
| 4 |
|
| 5 |
def process_input(job_description, resumes):
|
| 6 |
# resumes = [r for r in resumes if r and r.strip() != ""] # Remove empty
|
|
|
|
| 10 |
print("[CATEGORIES]", resumes)
|
| 11 |
|
| 12 |
thinking, results = parse_resume(job_description, resumes)
|
| 13 |
+
print("[THINKING]", thinking)
|
| 14 |
+
print("[RESULTS]", results)
|
| 15 |
+
results = json.loads(results)
|
| 16 |
+
print("[SUCCESS JSON PARSING]")
|
| 17 |
return thinking, results
|
| 18 |
|
| 19 |
# results = zip(*parse_resume(job_description, resumes))
|
|
|
|
| 114 |
|
| 115 |
delete_json_button = gr.Button("Delete Category")
|
| 116 |
|
| 117 |
+
json_display = gr.JSON(value=initial_parsing, label="Parsing Categories", show_label=True)
|
|
|
|
| 118 |
delete_json_button.click(delete_json, inputs=[json_display, category_delete], outputs=json_display)
|
| 119 |
job_description = gr.Textbox(
|
| 120 |
lines=8,
|
|
|
|
| 122 |
label="CV / Resume"
|
| 123 |
)
|
| 124 |
|
| 125 |
+
with gr.Column():
|
| 126 |
# output = gr.Textbox(
|
| 127 |
# lines=10,
|
| 128 |
# label="JSON Result",
|
| 129 |
# interactive=False
|
| 130 |
# )
|
| 131 |
+
output = gr.JSON(show_indices=True, label="Parsing Output", show_label=True)
|
| 132 |
thinking_output = gr.Textbox(
|
| 133 |
lines=10,
|
| 134 |
label="Thinking Result",
|
| 135 |
interactive=False
|
| 136 |
)
|
| 137 |
|
| 138 |
+
submit_btn = gr.Button("π Parse Resume / CV")
|
| 139 |
+
submit_btn.click(
|
| 140 |
+
fn=process_input,
|
| 141 |
+
inputs=[job_description, json_display],
|
| 142 |
+
outputs=[thinking_output, output]
|
| 143 |
+
)
|
| 144 |
|
| 145 |
|
| 146 |
# add_resume_btn.click(add_resume, outputs=resumes_group)
|