Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,7 +31,11 @@ pipe = pipeline(
|
|
| 31 |
def infer(prompt):
|
| 32 |
return pipe(prompt, max_new_tokens=1, do_sample=True, temperature=1.0, return_full_text=False)[0]["generated_text"]
|
| 33 |
|
| 34 |
-
default_experiment =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
with gr.Blocks(
|
| 37 |
fill_width=True,
|
|
@@ -45,19 +49,20 @@ with gr.Blocks(
|
|
| 45 |
# ---------- NEW: info banner ----------
|
| 46 |
gr.Markdown(
|
| 47 |
"""
|
| 48 |
-
###
|
| 49 |
-
-
|
| 50 |
-
-
|
| 51 |
-
-
|
|
|
|
| 52 |
""",
|
| 53 |
elem_id="info-box",
|
| 54 |
)
|
| 55 |
|
| 56 |
# (optional) add a logo or hero image
|
| 57 |
gr.Image(
|
| 58 |
-
value="https://
|
| 59 |
show_label=False,
|
| 60 |
-
height=
|
| 61 |
elem_classes="mx-auto", # centres the image
|
| 62 |
)
|
| 63 |
# --------------------------------------
|
|
@@ -65,7 +70,7 @@ with gr.Blocks(
|
|
| 65 |
with gr.Row(equal_height=True):
|
| 66 |
inp = gr.Textbox(
|
| 67 |
label="Prompt", elem_id="prompt-box",
|
| 68 |
-
lines=12, max_lines=12, scale=3, value=
|
| 69 |
)
|
| 70 |
outp = gr.Textbox(
|
| 71 |
label="Response", elem_id="answer-box",
|
|
|
|
| 31 |
def infer(prompt):
|
| 32 |
return pipe(prompt, max_new_tokens=1, do_sample=True, temperature=1.0, return_full_text=False)[0]["generated_text"]
|
| 33 |
|
| 34 |
+
default_experiment = """Test
|
| 35 |
+
1
|
| 36 |
+
2
|
| 37 |
+
3
|
| 38 |
+
"""
|
| 39 |
|
| 40 |
with gr.Blocks(
|
| 41 |
fill_width=True,
|
|
|
|
| 49 |
# ---------- NEW: info banner ----------
|
| 50 |
gr.Markdown(
|
| 51 |
"""
|
| 52 |
+
### How to prompt:
|
| 53 |
+
- We did not employ a particular prompt template – just phrase everything in natural language.
|
| 54 |
+
- Human choices are encapsulated by "<<" and ">>" tokens.
|
| 55 |
+
- Most experiments in the training data are framed in terms of button presses. If possible, it is recommended to use that style.
|
| 56 |
+
- You can find examples in the Supporting Information of our paper.
|
| 57 |
""",
|
| 58 |
elem_id="info-box",
|
| 59 |
)
|
| 60 |
|
| 61 |
# (optional) add a logo or hero image
|
| 62 |
gr.Image(
|
| 63 |
+
value="https://marcelbinz.github.io/imgs/centaur.png",
|
| 64 |
show_label=False,
|
| 65 |
+
height=100,
|
| 66 |
elem_classes="mx-auto", # centres the image
|
| 67 |
)
|
| 68 |
# --------------------------------------
|
|
|
|
| 70 |
with gr.Row(equal_height=True):
|
| 71 |
inp = gr.Textbox(
|
| 72 |
label="Prompt", elem_id="prompt-box",
|
| 73 |
+
lines=12, max_lines=12, scale=3, value=default_experiment
|
| 74 |
)
|
| 75 |
outp = gr.Textbox(
|
| 76 |
label="Response", elem_id="answer-box",
|