Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upload folder using huggingface_hub
Browse files- README.md +3 -9
- app.py +93 -0
- requirements.txt +2 -0
README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji: 🐠
|
4 |
-
colorFrom: indigo
|
5 |
-
colorTo: yellow
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 4.26.0
|
8 |
app_file: app.py
|
9 |
-
|
|
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: SMART_Goals_Builder_powered_by_Llama2_and_Groq
|
|
|
|
|
|
|
|
|
|
|
3 |
app_file: app.py
|
4 |
+
sdk: gradio
|
5 |
+
sdk_version: 4.22.0
|
6 |
---
|
|
|
|
app.py
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import os
|
3 |
+
from groq import Groq
|
4 |
+
|
5 |
+
groq_client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
|
6 |
+
|
7 |
+
def call_groq_api(specific, measurable, achievable, relevant, time_bound):
|
8 |
+
|
9 |
+
prompt = f"""
|
10 |
+
Act as a world-class professional consultant and SMART Goal writer.
|
11 |
+
Generate three distinct, well-written SMART goal statements in complete sentences by taking into account the SMART criteria provided.
|
12 |
+
Specific (S): {specific}
|
13 |
+
Measurable (M): {measurable}
|
14 |
+
Achievable (A): {achievable}
|
15 |
+
Relevant (R): {relevant}
|
16 |
+
Time-bound (T): {time_bound}
|
17 |
+
|
18 |
+
Format each option as a complete professional high-quality SMART goal in one sentence and number them as Option 1, Option 2, and Option 3.
|
19 |
+
"""
|
20 |
+
|
21 |
+
chat_completion = groq_client.chat.completions.create(
|
22 |
+
messages=[{"role": "user", "content": prompt}],
|
23 |
+
model="llama2-70b-4096",
|
24 |
+
)
|
25 |
+
|
26 |
+
if chat_completion.choices:
|
27 |
+
generated_text = chat_completion.choices[0].message.content
|
28 |
+
print("LLM Response:", generated_text)
|
29 |
+
options = generated_text.split('\n\n')
|
30 |
+
formatted_options = [opt for opt in options if opt.strip().startswith('Option')]
|
31 |
+
return '\n\n'.join(formatted_options)
|
32 |
+
else:
|
33 |
+
print("Error: No response from Groq API or API returned an unexpected format.")
|
34 |
+
return "Error: No response from Groq API."
|
35 |
+
|
36 |
+
smart_examples = {
|
37 |
+
"specific": [
|
38 |
+
"Increase quarterly sales revenue by focusing on upsells and expanding into the health segment",
|
39 |
+
"Raise customer satisfaction scores using targeted service improvements",
|
40 |
+
"Grow team productivity by implementing a new collaborative project management tool",
|
41 |
+
"Complete an advanced coding course on Coursera and contribute to a live project",
|
42 |
+
"Attend five key industry networking events to forge at least ten new strategic relationships"
|
43 |
+
],
|
44 |
+
"measurable": [
|
45 |
+
"Achieve a 15 percent increase in sales compared to the previous quarter",
|
46 |
+
"Improve customer satisfaction scores by 15 points on our satisfaction survey",
|
47 |
+
"Complete the Coursera coding course with a final project review score of 80 percent or higher",
|
48 |
+
"Connect with at least ten new potential partners or clients at each networking event",
|
49 |
+
"Increase the number of successful project deliveries by 20% within the next fiscal year"
|
50 |
+
],
|
51 |
+
"achievable": [
|
52 |
+
"Targeting existing customers with a proven 20 percent interest in health and wellness products",
|
53 |
+
"Introducing a customer feedback loop and response team within the next month",
|
54 |
+
"Leveraging existing resources and the new tool to streamline task management",
|
55 |
+
"Dedicating 5 hours per week to online learning and project work",
|
56 |
+
"Selecting events based on past success rates for networking and lead generation"
|
57 |
+
],
|
58 |
+
"relevant": [
|
59 |
+
"Aligning with the strategic goal to penetrate the health and wellness market",
|
60 |
+
"Directly addressing a key pain point identified in the last customer satisfaction audit",
|
61 |
+
"Supporting the company-wide initiative to enhance teamwork and efficiency",
|
62 |
+
"Complementing current role responsibilities with an upgraded skill set",
|
63 |
+
"Expanding business contacts in line with the growth strategy for the coming year"
|
64 |
+
],
|
65 |
+
"time_bound": [
|
66 |
+
"By the end of the second quarter",
|
67 |
+
"Within the next six months to coincide with the next customer review cycle",
|
68 |
+
"By the end of the current fiscal year",
|
69 |
+
"Within the next three months, in time to apply skills to Q4 projects",
|
70 |
+
"Over the next six months, strategically spaced to maintain momentum"
|
71 |
+
]
|
72 |
+
}
|
73 |
+
def smart_goal_interface(specific, measurable, achievable, relevant, time_bound):
|
74 |
+
return call_groq_api(specific, measurable, achievable, relevant, time_bound)
|
75 |
+
|
76 |
+
interface = gr.Interface(
|
77 |
+
fn=smart_goal_interface,
|
78 |
+
inputs=[
|
79 |
+
gr.Dropdown(label="Specific (S)", allow_custom_value=True, choices=smart_examples['specific'], info="Select from an example or type out your specific goal"),
|
80 |
+
gr.Dropdown(label="Measurable (M)", allow_custom_value=True, choices=smart_examples['measurable'], info="Select from an example or type out how you will measure the goal"),
|
81 |
+
gr.Dropdown(label="Achievable (A)", allow_custom_value=True, choices=smart_examples['achievable'], info="Select from an example or type out how the goal is challenging yet achievable"),
|
82 |
+
gr.Dropdown(label="Relevant (R)", allow_custom_value=True, choices=smart_examples['relevant'], info="Select from an example or type out why this goal is important"),
|
83 |
+
gr.Dropdown(label="Time-bound (T)", allow_custom_value=True, choices=smart_examples['time_bound'], info="Select from an example or type out enter the deadline for the goal")
|
84 |
+
],
|
85 |
+
outputs=[
|
86 |
+
gr.Textbox(label="Generated SMART Goals", lines=10, placeholder="Generated content will appear here...")
|
87 |
+
],
|
88 |
+
title="SMART Goals Builder powered by Llama2 and Groq",
|
89 |
+
description="Fill out each field to generate SMART goals."
|
90 |
+
)
|
91 |
+
|
92 |
+
if __name__ == "__main__":
|
93 |
+
interface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
groq
|