Spaces:
PhilSpiel
/
Sleeping

PhilSpiel commited on
Commit
642987a
·
verified ·
1 Parent(s): 44446f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -9,23 +9,24 @@ coach_code = os.getenv("COACH_CODE")
9
  coach_name_short = os.getenv("COACH_NAME_SHORT")
10
  coach_name_upper = os.getenv("COACH_NAME_UPPER")
11
  sys_prompt_new = os.getenv("PROMPT_NEW")
12
- theme="sudeepshouche/minimalist"
13
  ################# End PERSONA-SPECIFIC VALUES ######################
14
 
15
  ################# Start OpenAI-SPECIFIC VALUES ######################
16
  # Initialize OpenAI API client with API key
17
  client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
18
  # OpenAI model
19
- openai_model = "gpt-3.5-turbo-0125"
20
  ################# End OpenAI-SPECIFIC VALUES ######################
21
 
22
  tx = os.getenv("TX")
23
  prefix = os.getenv("PREFIX") # "/data/" if in HF or "data/" if local
 
24
 
25
  ############### CHAT ###################
26
  def predict(user_input, history):
27
  max_length = 500
28
- transcript_file_path = f"{prefix}{coach_code}-transcript.txt"
29
  transcript = "" # Initialize the transcript variable
30
 
31
  if user_input == tx:
@@ -36,7 +37,7 @@ def predict(user_input, history):
36
  transcript = file.read()
37
  return transcript
38
  except FileNotFoundError:
39
- return "File " + transcript_file_path + " not found."
40
  elif len(user_input) > max_length:
41
  raise gr.Error(f"Input is TOO LONG. Max length is {max_length} characters. Try again.")
42
 
 
9
  coach_name_short = os.getenv("COACH_NAME_SHORT")
10
  coach_name_upper = os.getenv("COACH_NAME_UPPER")
11
  sys_prompt_new = os.getenv("PROMPT_NEW")
12
+ theme=os.getenv("THEME")
13
  ################# End PERSONA-SPECIFIC VALUES ######################
14
 
15
  ################# Start OpenAI-SPECIFIC VALUES ######################
16
  # Initialize OpenAI API client with API key
17
  client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
18
  # OpenAI model
19
+ openai_model = os.getenv("OPENAI_MODEL")
20
  ################# End OpenAI-SPECIFIC VALUES ######################
21
 
22
  tx = os.getenv("TX")
23
  prefix = os.getenv("PREFIX") # "/data/" if in HF or "data/" if local
24
+ file_name = os.getenv("FILE_NAME")
25
 
26
  ############### CHAT ###################
27
  def predict(user_input, history):
28
  max_length = 500
29
+ transcript_file_path = f"{prefix}{coach_code}-{file_name}"
30
  transcript = "" # Initialize the transcript variable
31
 
32
  if user_input == tx:
 
37
  transcript = file.read()
38
  return transcript
39
  except FileNotFoundError:
40
+ return "File '" + os.getenv("FILE_NAME") + "' not found."
41
  elif len(user_input) > max_length:
42
  raise gr.Error(f"Input is TOO LONG. Max length is {max_length} characters. Try again.")
43