cdcvd commited on
Commit
78c2eb5
·
verified ·
1 Parent(s): 622359b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -59,13 +59,11 @@ def main(resume_text, job_description):
59
  "predicted_target": predicted_target[0]
60
  }
61
 
62
- def process_files(resume_file, job_description_file):
63
  try:
64
- resume_text = resume_file.decode('utf-8')
65
- job_description = job_description_file.decode('utf-8')
66
-
67
- output = main(resume_text, job_description)
68
 
 
69
  with tempfile.NamedTemporaryFile(delete=False, suffix=".json", mode='w', encoding='utf-8') as tmp_file:
70
  json.dump(output, tmp_file, ensure_ascii=False, indent=4)
71
  return tmp_file.name
@@ -76,8 +74,9 @@ def process_files(resume_file, job_description_file):
76
  return tmp_file.name
77
 
78
  iface = gr.Interface(
79
- fn=process_files,
80
- inputs=[gr.File(label="رزومه (فایل .txt)"), gr.File(label="توضیحات شغل (فایل .txt)")],
 
81
  outputs=gr.File(label="دانلود فایل JSON"),
82
  title="پردازش رزومه و توضیحات شغلی",
83
  description="این ابزار رزومه و توضیحات شغلی شما را پردازش کرده و امتیازات مشابهت را محاسبه می‌کند."
 
59
  "predicted_target": predicted_target[0]
60
  }
61
 
62
+ def process_text(resume_text, job_description_text):
63
  try:
64
+ output = main(resume_text, job_description_text)
 
 
 
65
 
66
+ # ذخیره خروجی JSON در یک فایل موقت
67
  with tempfile.NamedTemporaryFile(delete=False, suffix=".json", mode='w', encoding='utf-8') as tmp_file:
68
  json.dump(output, tmp_file, ensure_ascii=False, indent=4)
69
  return tmp_file.name
 
74
  return tmp_file.name
75
 
76
  iface = gr.Interface(
77
+ fn=process_text,
78
+ inputs=[gr.Textbox(lines=10, placeholder="لطفاً رزومه خود را وارد کنید..."),
79
+ gr.Textbox(lines=10, placeholder="لطفاً توضیحات شغلی را وارد کنید...")],
80
  outputs=gr.File(label="دانلود فایل JSON"),
81
  title="پردازش رزومه و توضیحات شغلی",
82
  description="این ابزار رزومه و توضیحات شغلی شما را پردازش کرده و امتیازات مشابهت را محاسبه می‌کند."