arjunakurian commited on
Commit
dd0a8a6
1 Parent(s): bf21561

Upload 3 files

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. bg1.jpg +3 -0
  3. dataset.csv +7 -0
  4. mhealth7.py +74 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ bg1.jpg filter=lfs diff=lfs merge=lfs -text
bg1.jpg ADDED

Git LFS Details

  • SHA256: d585d2906888efd5656fc33463ef4f2ffeb82c34e54ff134a2025e7544312117
  • Pointer size: 132 Bytes
  • Size of remote file: 1.38 MB
dataset.csv ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ Questions for 13-17,Questions for 18-21,Questions for 21-25,Questions for 25-40,Questions for 40-60,Questions for 60+
2
+ Do you feel bullied at school?,Do you have plans for after high school?,Do you have plans for the future?,Are you stressed at work?,What do you think about your health?,How do you feel about retirement?
3
+ Do you have a lot of friends?,How is your relationship with your family?,Are you able to balance work and social life?,How are your relationships with your coworkers?,Do you feel happy about your career?,Do you wish you had done things differently in your life?
4
+ Do you feel safe at school?,What do you enjoy doing in your free time?,Are you able to manage your finances?,How is your relationship with your family?,How is your relationship with your family?,How is your health?
5
+ Are you motivated to study?,What do you think about your current work-life balance?,Are you happy with your current career path?,Any major life changes?,How do you handle difficult customers or clients at work?,Do you feel like you have saved enough for retirement?
6
+ Do your parents fight?,Do you maintain healthy relationships?,How do you manage stress in your daily life?,What do you think about your current living situation?,What are some of your favorite hobbies or interests?,Do you miss anyone?(friends/family)
7
+ What are your thoughts on growing up?,Are you afraid about your future?,Do you stay connected with friends and family?,Are you able to maintain your physical and mental health?,How do you feel about your life so far?,Do you feel like you found your purpose in life?
mhealth7.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ from flask import Flask, render_template, request, redirect, url_for
3
+ import openai
4
+
5
+ # Set up OpenAI API key
6
+ openai.api_key = "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"
7
+
8
+ # Load dataset from csv file
9
+ dataset = pd.read_csv("dataset.csv")
10
+
11
+ # Define function to prompt user and get response
12
+ def ask_question(prompt):
13
+ response = input(prompt + " ")
14
+ return response.lower()
15
+
16
+ # Define function to generate advice based on user input
17
+ def generate_advice(problem):
18
+ # Construct prompt for OpenAI API
19
+ prompt = f"I am feeling {problem}. Please provide some advice."
20
+ # Use OpenAI's GPT-3 model to generate advice based on the prompt
21
+ response = openai.Completion.create(
22
+ engine="text-davinci-002",
23
+ prompt=prompt,
24
+ max_tokens=1024,
25
+ n=1,
26
+ stop=None,
27
+ temperature=0.7
28
+ )
29
+ # Extract the generated advice from the API response
30
+ advice = response.choices[0].text.strip()
31
+ return advice
32
+
33
+ app = Flask(__name__)
34
+
35
+ @app.route('/')
36
+ def index():
37
+ return render_template('index.html')
38
+
39
+ @app.route('/advice', methods=['POST'])
40
+ def advice():
41
+ age = int(request.form['age'])
42
+ return redirect(url_for('show_questions', age=age))
43
+
44
+ @app.route('/questions/<age>', methods=['GET', 'POST'])
45
+ def show_questions(age):
46
+ age = int(age) # Convert age to integer
47
+
48
+ if request.method == 'GET':
49
+ if age >= 13 and age <= 17:
50
+ questions = dataset["Questions for 13-17"].tolist()
51
+ elif age >= 18 and age <= 21:
52
+ questions = dataset["Questions for 18-21"].tolist()
53
+ elif age >= 21 and age <= 25:
54
+ questions = dataset["Questions for 21-25"].tolist()
55
+ elif age >= 25 and age <= 40:
56
+ questions = dataset["Questions for 25-40"].tolist()
57
+ elif age >= 40 and age <= 60:
58
+ questions = dataset["Questions for 40-60"].tolist()
59
+ else:
60
+ questions = dataset["Questions for 60+"].tolist()
61
+
62
+ return render_template('questions.html', age=age, questions=questions)
63
+
64
+ elif request.method == 'POST':
65
+ answers = []
66
+ for i in range(6):
67
+ answer = request.form.get(f'answer{i+1}')
68
+ answers.append(answer)
69
+ # Process the answers and generate advice
70
+ advice = generate_advice(answers)
71
+ return render_template('advice.html', advice=advice)
72
+
73
+ if __name__ == '__main__':
74
+ app.run(debug=True)