Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -21,11 +21,12 @@ openai_model = os.getenv("OPENAI_MODEL")
|
|
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}-
|
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 '
|
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 |
|
|
|
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 |
|