Spaces:
Runtime error
Runtime error
update example
Browse files
app.py
CHANGED
|
@@ -69,10 +69,10 @@ class ModelManager:
|
|
| 69 |
self.c2c_checkpoint_path = c2c_checkpoint_path
|
| 70 |
|
| 71 |
# T2T prompt configurations
|
| 72 |
-
self.t2t_background_prompt = "
|
| 73 |
self.t2t_answer_prompt = "Based on the background, answer the question:\n\n{question}" # Format for second round question
|
| 74 |
self.t2t_context_max_tokens = 256
|
| 75 |
-
self.t2t_answer_max_tokens =
|
| 76 |
|
| 77 |
# Generation configuration (shared across all models)
|
| 78 |
# To enable sampling: set use_sampling=True and adjust temperature/top_p/top_k
|
|
@@ -393,16 +393,11 @@ def create_demo(model_manager: ModelManager):
|
|
| 393 |
EXAMPLE_QUESTIONS = {
|
| 394 |
"example1": """Why is the Mars Exploration Rover Spirit currently tilted towards the north?
|
| 395 |
|
| 396 |
-
A. Because it
|
| 397 |
-
B. Because it
|
| 398 |
-
C. Because it
|
| 399 |
D. Because one of its wheels broke.""",
|
| 400 |
-
"example2": """
|
| 401 |
-
|
| 402 |
-
A. Why the act of destroying nature might be immoral.
|
| 403 |
-
B. Why people who destroy the environment might be bad people.
|
| 404 |
-
C. How the decision to preserve the environment benefits the environment.
|
| 405 |
-
D. Whether plants have interests."""
|
| 406 |
}
|
| 407 |
|
| 408 |
def respond(user_input: str):
|
|
@@ -469,7 +464,7 @@ D. Whether plants have interests."""
|
|
| 469 |
gr.Markdown("Example Questions:")
|
| 470 |
with gr.Row():
|
| 471 |
example1_btn = gr.Button("π Example 1: Astronomy", size="sm")
|
| 472 |
-
example2_btn = gr.Button("π Example 2:
|
| 473 |
|
| 474 |
|
| 475 |
with gr.Row():
|
|
|
|
| 69 |
self.c2c_checkpoint_path = c2c_checkpoint_path
|
| 70 |
|
| 71 |
# T2T prompt configurations
|
| 72 |
+
self.t2t_background_prompt = "In one clear sentence, describe the most essential background knowledge needed to answer the question:\n\n{question}\n\nDo NOT directly solve or give answer to the question."
|
| 73 |
self.t2t_answer_prompt = "Based on the background, answer the question:\n\n{question}" # Format for second round question
|
| 74 |
self.t2t_context_max_tokens = 256
|
| 75 |
+
self.t2t_answer_max_tokens = 512
|
| 76 |
|
| 77 |
# Generation configuration (shared across all models)
|
| 78 |
# To enable sampling: set use_sampling=True and adjust temperature/top_p/top_k
|
|
|
|
| 393 |
EXAMPLE_QUESTIONS = {
|
| 394 |
"example1": """Why is the Mars Exploration Rover Spirit currently tilted towards the north?
|
| 395 |
|
| 396 |
+
A. Because itβs climbing up a big hill.
|
| 397 |
+
B. Because itβs in the southern hemisphere where it is winter now.
|
| 398 |
+
C. Because itβs in the northern hemisphere where it is winter now.
|
| 399 |
D. Because one of its wheels broke.""",
|
| 400 |
+
"example2": """In an experiment, you have two saltwater samples. The first is 500g at 20% concentration, and the second is 300g at 10% concentration. If you mix them together, what will be the mass percent of salt in the final solution? (Give your answer to one decimal place)."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
}
|
| 402 |
|
| 403 |
def respond(user_input: str):
|
|
|
|
| 464 |
gr.Markdown("Example Questions:")
|
| 465 |
with gr.Row():
|
| 466 |
example1_btn = gr.Button("π Example 1: Astronomy", size="sm")
|
| 467 |
+
example2_btn = gr.Button("π Example 2: Simple Math", size="sm")
|
| 468 |
|
| 469 |
|
| 470 |
with gr.Row():
|