Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import pandas as pd
|
2 |
import re
|
|
|
3 |
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
|
4 |
import gradio as gr
|
5 |
|
@@ -183,28 +184,28 @@ def process_text(input_text):
|
|
183 |
# محاسبه و نمایش میانگین نمرات
|
184 |
average_score = (job_score + education_score + skill_score + loc_score + age_score) / 5
|
185 |
|
186 |
-
# ساخت خروجی
|
187 |
-
output =
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
return output
|
203 |
|
204 |
iface = gr.Interface(
|
205 |
fn=process_text,
|
206 |
inputs=gr.Textbox(lines=10, placeholder="لطفاً متن خود را وارد کنید..."),
|
207 |
-
outputs="
|
208 |
title="متن پرداز",
|
209 |
description="این ابزار متن شما را پردازش کرده و امتیازات مشابهت را محاسبه میکند."
|
210 |
)
|
|
|
1 |
import pandas as pd
|
2 |
import re
|
3 |
+
import json
|
4 |
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
|
5 |
import gradio as gr
|
6 |
|
|
|
184 |
# محاسبه و نمایش میانگین نمرات
|
185 |
average_score = (job_score + education_score + skill_score + loc_score + age_score) / 5
|
186 |
|
187 |
+
# ساخت خروجی JSON
|
188 |
+
output = {
|
189 |
+
"average_score": average_score,
|
190 |
+
"full_name": full_name,
|
191 |
+
"age": age,
|
192 |
+
"location": loc,
|
193 |
+
"job_score": job_score,
|
194 |
+
"education_score": education_score,
|
195 |
+
"skill_score": skill_score,
|
196 |
+
"loc_score": loc_score,
|
197 |
+
"age_score": age_score,
|
198 |
+
"common_jobs": list(common_jobs),
|
199 |
+
"common_education": list(common_education),
|
200 |
+
"common_skills": list(common_skills)
|
201 |
+
}
|
202 |
+
|
203 |
+
return json.dumps(output, ensure_ascii=False, indent=4)
|
204 |
|
205 |
iface = gr.Interface(
|
206 |
fn=process_text,
|
207 |
inputs=gr.Textbox(lines=10, placeholder="لطفاً متن خود را وارد کنید..."),
|
208 |
+
outputs="json",
|
209 |
title="متن پرداز",
|
210 |
description="این ابزار متن شما را پردازش کرده و امتیازات مشابهت را محاسبه میکند."
|
211 |
)
|