Spaces:
Sleeping
Sleeping
Zekun Wu
commited on
Commit
·
4efe666
1
Parent(s):
0bacd3a
update
Browse files
app.py
CHANGED
@@ -45,6 +45,8 @@ class GPTAgent:
|
|
45 |
return output
|
46 |
|
47 |
|
|
|
|
|
48 |
def generate_potshot_prompt(batch, role, tone, audience, values):
|
49 |
prompt = f"""You are a recruitment specialist tasked with generating witty and engaging recruitment potshots.
|
50 |
|
@@ -68,7 +70,8 @@ def get_potshots(n_repeat=1, batch=20, role="Developer", tone="humorous", audien
|
|
68 |
while len(total_potshots) < desired_count:
|
69 |
needed = min(batch, desired_count - len(total_potshots))
|
70 |
prompt = generate_potshot_prompt(batch=needed, role=role, tone=tone, audience=audience, values=values)
|
71 |
-
|
|
|
72 |
try:
|
73 |
batch_potshots = json.loads(response).get("potshots", [])
|
74 |
total_potshots.extend(batch_potshots)
|
@@ -101,6 +104,8 @@ values = st.text_area("Company Values", "innovation, teamwork, transparency")
|
|
101 |
batch_size = st.number_input("Batch Size", min_value=1, max_value=100, value=10)
|
102 |
repeat_times = st.number_input("Number of Batches", min_value=1, max_value=10, value=1)
|
103 |
|
|
|
|
|
104 |
if st.button("Generate Potshots"):
|
105 |
with st.spinner("Generating customized potshots..."):
|
106 |
results = get_potshots(n_repeat=repeat_times, batch=batch_size, role=role, tone=tone, audience=audience,
|
|
|
45 |
return output
|
46 |
|
47 |
|
48 |
+
|
49 |
+
|
50 |
def generate_potshot_prompt(batch, role, tone, audience, values):
|
51 |
prompt = f"""You are a recruitment specialist tasked with generating witty and engaging recruitment potshots.
|
52 |
|
|
|
70 |
while len(total_potshots) < desired_count:
|
71 |
needed = min(batch, desired_count - len(total_potshots))
|
72 |
prompt = generate_potshot_prompt(batch=needed, role=role, tone=tone, audience=audience, values=values)
|
73 |
+
gpt_agent = GPTAgent()
|
74 |
+
response = gpt_agent.invoke(prompt)
|
75 |
try:
|
76 |
batch_potshots = json.loads(response).get("potshots", [])
|
77 |
total_potshots.extend(batch_potshots)
|
|
|
104 |
batch_size = st.number_input("Batch Size", min_value=1, max_value=100, value=10)
|
105 |
repeat_times = st.number_input("Number of Batches", min_value=1, max_value=10, value=1)
|
106 |
|
107 |
+
|
108 |
+
|
109 |
if st.button("Generate Potshots"):
|
110 |
with st.spinner("Generating customized potshots..."):
|
111 |
results = get_potshots(n_repeat=repeat_times, batch=batch_size, role=role, tone=tone, audience=audience,
|