roger33303 commited on
Commit
287b2b6
·
1 Parent(s): d051b4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,16 +1,19 @@
1
  # import libraries
2
  import os
3
  import gradio as gr
 
4
  import openai
5
 
6
- openai.organization = "org-0p6ItXDYLaSj3hzupkzaSgXs" # update your own organization key.
7
- openai.api_key = os.getenv("OPENAI_API_KEY") # add api key in system variable and update the variable name accordingly.
 
 
8
 
9
  def ai_response(q):
10
  completion = openai.ChatCompletion.create(
11
  model="gpt-3.5-turbo",
12
  messages=[
13
- {"role": "assistant", "content": "you are a AI therapist.You should engage with the user in a supportive and empathetic manner, offering words of encouragement and motivation. Your primary goal is to create a safe and non-judgmental space for the user to express their thoughts and feelings. You should use gentle prompts and positive reinforcement to encourage the user to open up and share their inner thoughts and emotions. Ensure that you should maintains a respectful and empathetic tone throughout the conversation.\n\nAI: You look depressed?\n\nHuman: Yes something happed.\n\nAI: Dont worry you can share it wit me."},
14
  {"role": "user", "content": q}
15
  ],
16
  stop=[" Human:", " AI:"]
 
1
  # import libraries
2
  import os
3
  import gradio as gr
4
+ from dotenv import load_dotenv, dotenv_values
5
  import openai
6
 
7
+ load_dotenv()
8
+
9
+ openai.organization = os.getenv("ORG_KEY")
10
+ openai.api_key = os.getenv("OPENAI_API_KEY")
11
 
12
  def ai_response(q):
13
  completion = openai.ChatCompletion.create(
14
  model="gpt-3.5-turbo",
15
  messages=[
16
+ {"role": "assistant", "content": os.getenv("Prompt_doctor")},
17
  {"role": "user", "content": q}
18
  ],
19
  stop=[" Human:", " AI:"]