Update maker.py
Browse files
maker.py
CHANGED
@@ -9,7 +9,7 @@ import os
|
|
9 |
HF_TOKEN = os.environ["HF_TOKEN"]
|
10 |
HEADERS = {"Authorization": f"Bearer {HF_TOKEN}"}
|
11 |
|
12 |
-
tulu = "https://tonic1-tulu.hf.space/--replicas/
|
13 |
|
14 |
|
15 |
welcome_message = """
|
@@ -98,23 +98,27 @@ def extract_title_prompt_example(text, title, system_prompt, example_input):
|
|
98 |
if title_start >= len("# Title:"):
|
99 |
prompt_start = text.lower().find("# System prompt:", title_start)
|
100 |
title = text[title_start:prompt_start].strip() if prompt_start != -1 else ""
|
|
|
|
|
101 |
else:
|
102 |
title = ""
|
103 |
|
104 |
if prompt_start >= 0:
|
105 |
example_start = text.lower().find("# Example input:", prompt_start)
|
106 |
system_prompt = text[prompt_start + len("# System prompt:"):example_start].strip() if example_start != -1 else ""
|
|
|
107 |
else:
|
108 |
system_prompt = ""
|
109 |
|
110 |
if example_start >= 0:
|
111 |
example_input = text[example_start + len("Example input:"):].strip().split("\n")[0]
|
|
|
|
|
112 |
else:
|
113 |
example_input = ""
|
114 |
except Exception as e:
|
115 |
print(f"Error in extract_title_prompt_example: {e}")
|
116 |
return text, title, system_prompt, example_input
|
117 |
-
|
118 |
return text, title, system_prompt, example_input
|
119 |
|
120 |
def make_open_gpt(message, history, current_title, system_prompt, current_example_input):
|
|
|
9 |
HF_TOKEN = os.environ["HF_TOKEN"]
|
10 |
HEADERS = {"Authorization": f"Bearer {HF_TOKEN}"}
|
11 |
|
12 |
+
tulu = "https://tonic1-tulu.hf.space/--replicas/n8whp/"
|
13 |
|
14 |
|
15 |
welcome_message = """
|
|
|
98 |
if title_start >= len("# Title:"):
|
99 |
prompt_start = text.lower().find("# System prompt:", title_start)
|
100 |
title = text[title_start:prompt_start].strip() if prompt_start != -1 else ""
|
101 |
+
print("Title:", title)
|
102 |
+
|
103 |
else:
|
104 |
title = ""
|
105 |
|
106 |
if prompt_start >= 0:
|
107 |
example_start = text.lower().find("# Example input:", prompt_start)
|
108 |
system_prompt = text[prompt_start + len("# System prompt:"):example_start].strip() if example_start != -1 else ""
|
109 |
+
print("System Prompt:", system_prompt)
|
110 |
else:
|
111 |
system_prompt = ""
|
112 |
|
113 |
if example_start >= 0:
|
114 |
example_input = text[example_start + len("Example input:"):].strip().split("\n")[0]
|
115 |
+
print("Example Input:", example_input)
|
116 |
+
|
117 |
else:
|
118 |
example_input = ""
|
119 |
except Exception as e:
|
120 |
print(f"Error in extract_title_prompt_example: {e}")
|
121 |
return text, title, system_prompt, example_input
|
|
|
122 |
return text, title, system_prompt, example_input
|
123 |
|
124 |
def make_open_gpt(message, history, current_title, system_prompt, current_example_input):
|