Update app.py
Browse files
app.py
CHANGED
|
@@ -379,27 +379,25 @@ def load_dataset_config():
|
|
| 379 |
params = load_params()
|
| 380 |
with open("system_messages.py", "r") as f:
|
| 381 |
system_messages_content = f.read()
|
| 382 |
-
vodalus_system_message = re.search(r'SYSTEM_MESSAGES_VODALUS = \[(.*?)\]', system_messages_content, re.DOTALL).group(1).strip()[3:-3]
|
| 383 |
|
| 384 |
-
# Load PROMPT_1 from main.py
|
| 385 |
with open("main.py", "r") as f:
|
| 386 |
main_content = f.read()
|
| 387 |
prompt_1 = re.search(r'PROMPT_1 = """(.*?)"""', main_content, re.DOTALL).group(1).strip()
|
| 388 |
|
| 389 |
-
# Load TOPICS from topics.py
|
| 390 |
topics_module = importlib.import_module("topics")
|
| 391 |
topics_list = topics_module.TOPICS
|
| 392 |
|
| 393 |
-
return
|
| 394 |
-
vodalus_system_message,
|
| 395 |
-
prompt_1,
|
| 396 |
-
[[topic] for topic in topics_list],
|
| 397 |
-
params.get('max_tokens', 2048),
|
| 398 |
-
params.get('temperature', 0.7),
|
| 399 |
-
params.get('top_p', 0.9),
|
| 400 |
-
params.get('frequency_penalty', 0.0),
|
| 401 |
-
params.get('presence_penalty', 0.0)
|
| 402 |
-
|
| 403 |
|
| 404 |
|
| 405 |
|
|
@@ -1118,16 +1116,16 @@ with demo:
|
|
| 1118 |
|
| 1119 |
demo.load(
|
| 1120 |
lambda: (
|
| 1121 |
-
|
| 1122 |
-
gr.update(value=
|
| 1123 |
-
gr.update(value=
|
| 1124 |
-
gr.update(value=
|
| 1125 |
-
gr.update(value=
|
| 1126 |
-
gr.update(value=
|
| 1127 |
-
gr.update(value=
|
| 1128 |
-
gr.update(value=
|
| 1129 |
-
gr.update(value=
|
| 1130 |
-
)[1:],
|
| 1131 |
outputs=[
|
| 1132 |
vodalus_system_message,
|
| 1133 |
prompt_1,
|
|
|
|
| 379 |
params = load_params()
|
| 380 |
with open("system_messages.py", "r") as f:
|
| 381 |
system_messages_content = f.read()
|
| 382 |
+
vodalus_system_message = re.search(r'SYSTEM_MESSAGES_VODALUS = \[(.*?)\]', system_messages_content, re.DOTALL).group(1).strip()[3:-3]
|
| 383 |
|
|
|
|
| 384 |
with open("main.py", "r") as f:
|
| 385 |
main_content = f.read()
|
| 386 |
prompt_1 = re.search(r'PROMPT_1 = """(.*?)"""', main_content, re.DOTALL).group(1).strip()
|
| 387 |
|
|
|
|
| 388 |
topics_module = importlib.import_module("topics")
|
| 389 |
topics_list = topics_module.TOPICS
|
| 390 |
|
| 391 |
+
return {
|
| 392 |
+
"vodalus_system_message": vodalus_system_message,
|
| 393 |
+
"prompt_1": prompt_1,
|
| 394 |
+
"topics": [[topic] for topic in topics_list],
|
| 395 |
+
"max_tokens": params.get('max_tokens', 2048),
|
| 396 |
+
"temperature": params.get('temperature', 0.7),
|
| 397 |
+
"top_p": params.get('top_p', 0.9),
|
| 398 |
+
"frequency_penalty": params.get('frequency_penalty', 0.0),
|
| 399 |
+
"presence_penalty": params.get('presence_penalty', 0.0)
|
| 400 |
+
}
|
| 401 |
|
| 402 |
|
| 403 |
|
|
|
|
| 1116 |
|
| 1117 |
demo.load(
|
| 1118 |
lambda: (
|
| 1119 |
+
config := load_dataset_config(),
|
| 1120 |
+
gr.update(value=config["vodalus_system_message"]),
|
| 1121 |
+
gr.update(value=config["prompt_1"]),
|
| 1122 |
+
gr.update(value=config["topics"]),
|
| 1123 |
+
gr.update(value=config["max_tokens"]),
|
| 1124 |
+
gr.update(value=config["temperature"]),
|
| 1125 |
+
gr.update(value=config["top_p"]),
|
| 1126 |
+
gr.update(value=config["frequency_penalty"]),
|
| 1127 |
+
gr.update(value=config["presence_penalty"])
|
| 1128 |
+
)[1:],
|
| 1129 |
outputs=[
|
| 1130 |
vodalus_system_message,
|
| 1131 |
prompt_1,
|