Update maker.py
Browse files
maker.py
CHANGED
|
@@ -118,13 +118,21 @@ def extract_title_prompt_example(text):
|
|
| 118 |
|
| 119 |
|
| 120 |
def make_open_gpt(message, history, current_title, current_system_prompt, current_example_input, system_prompt=system_prompt):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
print("Response before extraction:", response) # Print the response before extraction
|
| 122 |
-
response = predict_beta(message, history, system_prompt)
|
| 123 |
-
response, title, system_prompt, example_input = extract_title_prompt_example(response)
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
# Ensure all expected outputs are returned
|
| 129 |
return (
|
| 130 |
"", # Placeholder for textbox
|
|
@@ -137,6 +145,7 @@ def make_open_gpt(message, history, current_title, current_system_prompt, curren
|
|
| 137 |
gr.Column(visible=True), # Column visibility control
|
| 138 |
gr.Group(visible=True) # Group visibility control
|
| 139 |
)
|
|
|
|
| 140 |
|
| 141 |
def set_title_example(title, example):
|
| 142 |
return [(None, welcome_preview_message.format(title, example))], example, gr.Column(visible=True), gr.Group(visible=True)
|
|
|
|
| 118 |
|
| 119 |
|
| 120 |
def make_open_gpt(message, history, current_title, current_system_prompt, current_example_input, system_prompt=system_prompt):
|
| 121 |
+
try:
|
| 122 |
+
response = predict_beta(message, history, system_prompt)
|
| 123 |
+
except Exception as e:
|
| 124 |
+
response = f"Error in predict_beta: {str(e)}"
|
| 125 |
+
|
| 126 |
print("Response before extraction:", response) # Print the response before extraction
|
|
|
|
|
|
|
| 127 |
|
| 128 |
+
try:
|
| 129 |
+
response, title, system_prompt, example_input = extract_title_prompt_example(response)
|
| 130 |
+
except Exception as e:
|
| 131 |
+
title = "Error"
|
| 132 |
+
system_prompt = "Error in extraction"
|
| 133 |
+
example_input = "Error"
|
| 134 |
+
print(f"Error in extract_title_prompt_example: {str(e)}")
|
| 135 |
+
|
| 136 |
# Ensure all expected outputs are returned
|
| 137 |
return (
|
| 138 |
"", # Placeholder for textbox
|
|
|
|
| 145 |
gr.Column(visible=True), # Column visibility control
|
| 146 |
gr.Group(visible=True) # Group visibility control
|
| 147 |
)
|
| 148 |
+
|
| 149 |
|
| 150 |
def set_title_example(title, example):
|
| 151 |
return [(None, welcome_preview_message.format(title, example))], example, gr.Column(visible=True), gr.Group(visible=True)
|