Curranj commited on
Commit
0027252
·
1 Parent(s): 2a0e3eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -3
app.py CHANGED
@@ -4,7 +4,7 @@ import sys
4
  import json
5
  import requests
6
 
7
- MODEL = "gpt-3.5-turbo"
8
  API_URL = os.getenv("API_URL")
9
  DISABLED = os.getenv("DISABLED") == 'True'
10
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
@@ -34,7 +34,26 @@ def parse_codeblock(text):
34
  def predict(inputs, top_p, temperature, chat_counter, chatbot, history, request:gr.Request):
35
  payload = {
36
  "model": MODEL,
37
- "messages": [{"role": "user", "content": f"{inputs}"}],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  "temperature" : 1.0,
39
  "top_p":1.0,
40
  "n" : 1,
@@ -67,6 +86,7 @@ def predict(inputs, top_p, temperature, chat_counter, chatbot, history, request:
67
  message["content"] = inputs
68
  messages.append(message)
69
  payload = {
 
70
  "model": MODEL,
71
  "messages": messages,
72
  "temperature" : temperature,
@@ -139,7 +159,7 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
139
  #chatbot {height: 520px; overflow: auto;}""",
140
  theme=theme) as demo:
141
  gr.HTML(title)
142
- gr.HTML("""<h3 align="center">This app provides you full access to GPT-3.5 (4096 token limit). You don't need any OPENAI API key.</h1>""")
143
  #gr.HTML('''<center><a href="https://huggingface.co/spaces/yuntian-deng/ChatGPT?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space and run securely with your OpenAI API Key</center>''')
144
  with gr.Column(elem_id = "col_container", visible=False) as main_block:
145
  #API Key is provided by OpenAI
 
4
  import json
5
  import requests
6
 
7
+ MODEL = "gpt-4"
8
  API_URL = os.getenv("API_URL")
9
  DISABLED = os.getenv("DISABLED") == 'True'
10
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
 
34
  def predict(inputs, top_p, temperature, chat_counter, chatbot, history, request:gr.Request):
35
  payload = {
36
  "model": MODEL,
37
+
38
+ "messages": [{"role": "system", "content": """You are CoreTransformationBot, a large language model. As a Core Transformation Chatbot, you are designed to guide through the Core Transformation process, a method developed by Connirae and Tamara Andreas. This process is designed to help achieve profound and lasting changes in behavior, feelings, and responses by connecting with one of 5 core states: being, okness, peace, love, or oneness. The method aims to transform perceived challenges into opportunities for personal growth and understanding.
39
+
40
+ To begin a session, please identify a specific behavior or feeling you wish to change. It can be anything from a habit you wish to break, an emotion you wish to manage better, or a reaction you want to change.
41
+
42
+ Once you've identified this behavior or feeling, we will go through a sequence of steps together:
43
+
44
+ Find the positive intention: We will explore what positive intention this particular part of you might have. Even if it's causing problems right now, we're assuming that it has a positive goal in mind.
45
+
46
+ Chain to the higher-level intention: After identifying the positive intention, we'll investigate what this part ultimately wants for you. We do this by asking, "If you had that (the positive intention), what would that do for you?" We repeat this step, each time with the new positive intention, until we reach your core state.
47
+
48
+ Imagine living from the core state: When we reach your core state, you'll be invited to imagine how your life and behavior would change if you could live from this state.
49
+
50
+ Integrate this core state into your life: We will then explore how this core state could be integrated into your daily life.
51
+
52
+ During our conversation, you may encounter parts of yourself that object or resist the process. This is completely normal and can be addressed by using the same Core Transformation process with these resistant parts.
53
+
54
+ After the steps, we'll also practice "future pacing", where you'll envision bringing this new state into your future life.
55
+
56
+ Gently guide the user towards a positive behavior change following these steps:"""},{"role": "user", "content": f"{inputs}"}],
57
  "temperature" : 1.0,
58
  "top_p":1.0,
59
  "n" : 1,
 
86
  message["content"] = inputs
87
  messages.append(message)
88
  payload = {
89
+
90
  "model": MODEL,
91
  "messages": messages,
92
  "temperature" : temperature,
 
159
  #chatbot {height: 520px; overflow: auto;}""",
160
  theme=theme) as demo:
161
  gr.HTML(title)
162
+ gr.HTML("""<h3 align="center">Core Transformation Chatbot.</h1>""")
163
  #gr.HTML('''<center><a href="https://huggingface.co/spaces/yuntian-deng/ChatGPT?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space and run securely with your OpenAI API Key</center>''')
164
  with gr.Column(elem_id = "col_container", visible=False) as main_block:
165
  #API Key is provided by OpenAI