Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,34 +1,112 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
def generate_cv(name, education, experience):
|
| 11 |
-
prompt = (
|
| 12 |
-
f"Generate a CV:\n"
|
| 13 |
-
f"Name: {name}\n"
|
| 14 |
-
f"Education: {education}\n"
|
| 15 |
-
f"Experience: {experience}\n"
|
| 16 |
-
"CV:\n"
|
| 17 |
-
)
|
| 18 |
-
outputs = generator(
|
| 19 |
-
prompt,
|
| 20 |
-
max_new_tokens=50,
|
| 21 |
-
do_sample=True,
|
| 22 |
-
top_k=50,
|
| 23 |
-
temperature=0.7
|
| 24 |
-
)
|
| 25 |
-
return outputs[0]["generated_text"]
|
| 26 |
|
|
|
|
| 27 |
demo = gr.Interface(
|
| 28 |
fn=generate_cv,
|
| 29 |
-
inputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
outputs="text",
|
| 31 |
-
title="
|
| 32 |
)
|
| 33 |
|
| 34 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
+
def generate_cv(
|
| 4 |
+
email,
|
| 5 |
+
date_of_birth,
|
| 6 |
+
mbti,
|
| 7 |
+
sustainable_dev_goals,
|
| 8 |
+
via_strength_1,
|
| 9 |
+
via_strength_2,
|
| 10 |
+
via_strength_3,
|
| 11 |
+
via_strength_4,
|
| 12 |
+
via_strength_5,
|
| 13 |
+
disc_d,
|
| 14 |
+
disc_i,
|
| 15 |
+
disc_s,
|
| 16 |
+
disc_c,
|
| 17 |
+
big5_extroversion,
|
| 18 |
+
big5_emotional_stability,
|
| 19 |
+
big5_agreeableness,
|
| 20 |
+
big5_conscientiousness,
|
| 21 |
+
big5_intellect,
|
| 22 |
+
past_project,
|
| 23 |
+
influences,
|
| 24 |
+
main_passions,
|
| 25 |
+
preferred_location,
|
| 26 |
+
ideal_work_environment,
|
| 27 |
+
productive_time,
|
| 28 |
+
partner_qualities,
|
| 29 |
+
vision
|
| 30 |
+
):
|
| 31 |
+
"""
|
| 32 |
+
Generates a text-based CV with Markdown tables.
|
| 33 |
+
Adjust the field order and names as needed.
|
| 34 |
+
"""
|
| 35 |
+
|
| 36 |
+
cv_text = f"""
|
| 37 |
+
# CV Template
|
| 38 |
+
|
| 39 |
+
## Essential Information
|
| 40 |
+
|
| 41 |
+
| Field | Details |
|
| 42 |
+
|---------------------------------|-------------------------------------------------|
|
| 43 |
+
| **Email Address** | {email} |
|
| 44 |
+
| **Date of Birth** | {date_of_birth} |
|
| 45 |
+
| **16 Personalities (MBTI)** | {mbti} |
|
| 46 |
+
| **Sustainable Development Goals** | {sustainable_dev_goals} |
|
| 47 |
+
| **VIA Strengths (Top 5)** | 1. {via_strength_1}<br>2. {via_strength_2}<br>3. {via_strength_3}<br>4. {via_strength_4}<br>5. {via_strength_5} |
|
| 48 |
+
|
| 49 |
+
## Personality Profile
|
| 50 |
+
|
| 51 |
+
| Field | Details |
|
| 52 |
+
|-------------------|---------------------------------------------------------------------------------------------------------|
|
| 53 |
+
| **DISC (D, I, S, C)** | D: {disc_d}%<br>I: {disc_i}%<br>S: {disc_s}%<br>C: {disc_c}% |
|
| 54 |
+
| **Big Five (OCEAN)** | Extroversion: {big5_extroversion}%<br>Emotional Stability: {big5_emotional_stability}%<br>Agreeableness: {big5_agreeableness}%<br>Conscientiousness: {big5_conscientiousness}%<br>Intellect/Imagination: {big5_intellect}% |
|
| 55 |
+
|
| 56 |
+
## Interests & Passions
|
| 57 |
+
|
| 58 |
+
| Field | Details |
|
| 59 |
+
|-------------------------------------------------|------------------------------------------|
|
| 60 |
+
| **Past Project or Workplace You Loved (Why)** | {past_project} |
|
| 61 |
+
| **People, Books, Courses, or Resources That Shaped You (Why)** | {influences} |
|
| 62 |
+
| **Main Passions and Topics of Interest** | {main_passions} |
|
| 63 |
+
|
| 64 |
+
## Collaboration Preferences
|
| 65 |
+
|
| 66 |
+
| Field | Details |
|
| 67 |
+
|--------------------------------------------------|-------------------------------------------------|
|
| 68 |
+
| **Preferred Country & Town for Meetups** | {preferred_location} |
|
| 69 |
+
| **Ideal Work Environment** | {ideal_work_environment} |
|
| 70 |
+
| **Most Productive Time of Day/Night** | {productive_time} |
|
| 71 |
+
| **Qualities in an Ideal Partner (Professional/Personal)** | {partner_qualities} |
|
| 72 |
+
| **Vision for Future Collaboration or Partnership** | {vision} |
|
| 73 |
+
"""
|
| 74 |
+
return cv_text.strip()
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
# Create a Gradio interface that matches the function's parameter order
|
| 78 |
demo = gr.Interface(
|
| 79 |
fn=generate_cv,
|
| 80 |
+
inputs=[
|
| 81 |
+
"text", # email
|
| 82 |
+
"text", # date_of_birth
|
| 83 |
+
"text", # mbti
|
| 84 |
+
"text", # sustainable_dev_goals
|
| 85 |
+
"text", # via_strength_1
|
| 86 |
+
"text", # via_strength_2
|
| 87 |
+
"text", # via_strength_3
|
| 88 |
+
"text", # via_strength_4
|
| 89 |
+
"text", # via_strength_5
|
| 90 |
+
"text", # disc_d
|
| 91 |
+
"text", # disc_i
|
| 92 |
+
"text", # disc_s
|
| 93 |
+
"text", # disc_c
|
| 94 |
+
"text", # big5_extroversion
|
| 95 |
+
"text", # big5_emotional_stability
|
| 96 |
+
"text", # big5_agreeableness
|
| 97 |
+
"text", # big5_conscientiousness
|
| 98 |
+
"text", # big5_intellect
|
| 99 |
+
"text", # past_project
|
| 100 |
+
"text", # influences
|
| 101 |
+
"text", # main_passions
|
| 102 |
+
"text", # preferred_location
|
| 103 |
+
"text", # ideal_work_environment
|
| 104 |
+
"text", # productive_time
|
| 105 |
+
"text", # partner_qualities
|
| 106 |
+
"text", # vision
|
| 107 |
+
],
|
| 108 |
outputs="text",
|
| 109 |
+
title="CV Template with Markdown Tables"
|
| 110 |
)
|
| 111 |
|
| 112 |
demo.launch()
|