Spaces:
Sleeping
Sleeping
Commit
·
1eb54c9
1
Parent(s):
5668536
Initial Commit
Browse files- .github/workflows/main.yml +20 -0
- .gitignore +1 -0
- README.md +12 -1
- app.py +66 -0
- requirements.txt +2 -0
.github/workflows/main.yml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Sync to Hugging Face hub
|
2 |
+
on:
|
3 |
+
push:
|
4 |
+
branches: [main]
|
5 |
+
|
6 |
+
# to run this workflow manually from the Actions tab
|
7 |
+
workflow_dispatch:
|
8 |
+
|
9 |
+
jobs:
|
10 |
+
sync-to-hub:
|
11 |
+
runs-on: ubuntu-latest
|
12 |
+
steps:
|
13 |
+
- uses: actions/checkout@v3
|
14 |
+
with:
|
15 |
+
fetch-depth: 0
|
16 |
+
lfs: true
|
17 |
+
- name: Push to hub
|
18 |
+
env:
|
19 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
20 |
+
run: git push --force https://fadliaulawi:[email protected]/spaces/KalbeDigitalLab/ai-mindfulness-apps main
|
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.env
|
README.md
CHANGED
@@ -1 +1,12 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Ai Mindfulness Apps
|
3 |
+
emoji: 👁
|
4 |
+
colorFrom: green
|
5 |
+
colorTo: purple
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: 1.37.1
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
---
|
11 |
+
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import os
|
3 |
+
|
4 |
+
from groq import Groq
|
5 |
+
from dotenv import load_dotenv
|
6 |
+
|
7 |
+
load_dotenv()
|
8 |
+
|
9 |
+
st.title("AI-powered Mindfulness App")
|
10 |
+
st.write("""
|
11 |
+
The application is designed to assist you in making informed decisions by providing a structured platform for consultation.
|
12 |
+
Embedded with Panca Sradha values, this application will ensure that all guidance aligns with the core principles upheld by Kalbe Group, promoting consistency and integrity in decision-making.
|
13 |
+
You can input the background context of the decision you are considering and articulate the specific questions for which you need guidance.
|
14 |
+
The application will generate two outputs: a detailed recommendation and a corresponding risk assessment with suggested mitigation strategies.
|
15 |
+
""")
|
16 |
+
|
17 |
+
# Input text boxes
|
18 |
+
input1 = st.text_area("Background", height=200)
|
19 |
+
input2 = st.text_area("Question", height=50)
|
20 |
+
|
21 |
+
client = Groq(
|
22 |
+
api_key=os.environ['GROQ_API_KEY'],
|
23 |
+
)
|
24 |
+
|
25 |
+
prompt = """
|
26 |
+
You are a company consultant in Kalbe Group with a deep understanding of the company's core values, known as Panca Sradha.
|
27 |
+
Your task is to provide strategic recommendations and mitigated risks based on the following inputs:
|
28 |
+
|
29 |
+
Background: {}
|
30 |
+
Question: {}
|
31 |
+
|
32 |
+
IMPORTANT: Your recommendations must align with the Panca Sradha values:
|
33 |
+
|
34 |
+
1. Trust is the glue of life.
|
35 |
+
2. Mindfulness is the foundation of our action.
|
36 |
+
3. Innovation is the key to our success.
|
37 |
+
4. Strive to be the best.
|
38 |
+
5. Interconnectedness is a universal way of life.
|
39 |
+
|
40 |
+
|
41 |
+
Based on these inputs, your task is to provide two outputs:
|
42 |
+
|
43 |
+
1. Recommendation: A detailed suggestion that aligns with Kalbe Group's strategic objectives.
|
44 |
+
2. Risk and Mitigation: An assessment of potential risks associated with the decision and corresponding strategies to mitigate these risks.
|
45 |
+
|
46 |
+
Ensure your response is connected to the Panca Sradha values by emphasizing them in italics whenever mentioned.
|
47 |
+
"""
|
48 |
+
|
49 |
+
def generate_answer(background, question):
|
50 |
+
|
51 |
+
chat_completion = client.chat.completions.create(
|
52 |
+
messages=[
|
53 |
+
{
|
54 |
+
"role": "user",
|
55 |
+
"content": prompt.format(background, question),
|
56 |
+
}
|
57 |
+
],
|
58 |
+
model="llama-3.1-8b-instant",
|
59 |
+
)
|
60 |
+
tasks = chat_completion.choices[0].message.content.strip()
|
61 |
+
|
62 |
+
return tasks
|
63 |
+
|
64 |
+
if st.button("Submit"):
|
65 |
+
result = generate_answer(input1, input2)
|
66 |
+
st.write(result)
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
groq
|
2 |
+
python-dotenv
|