cmagganas commited on
Commit
57da852
1 Parent(s): 5a3bd33

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app/app.py +10 -2
app/app.py CHANGED
@@ -20,8 +20,16 @@ if st.button("Run Data Cleaning API"):
20
  if text_input:
21
 
22
  MODEL = "gpt-4" # "gpt-3.5-turbo"
23
- sys_mes = open('../prompts/gpt4-system-message2.txt', 'r').read()
24
-
 
 
 
 
 
 
 
 
25
  # instantiate OpenAIChatCompletions class
26
  # get response from openai_chat_completion method
27
  chat = OpenAIChatCompletions(model=MODEL, system_message=sys_mes)
 
20
  if text_input:
21
 
22
  MODEL = "gpt-4" # "gpt-3.5-turbo"
23
+ try:
24
+ with open('prompts/gpt4-system-message2.txt', 'r', encoding='utf8') as f:
25
+ sys_mes = f.read()
26
+ f.close()
27
+
28
+ except FileNotFoundError:
29
+ with open('../prompts/gpt4-system-message2.txt', 'r', encoding='utf8') as f:
30
+ sys_mes = f.read()
31
+ f.close()
32
+
33
  # instantiate OpenAIChatCompletions class
34
  # get response from openai_chat_completion method
35
  chat = OpenAIChatCompletions(model=MODEL, system_message=sys_mes)