marcelbinz commited on
Commit
41a278c
·
verified ·
1 Parent(s): 2cdcac5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -33,7 +33,7 @@ pipe = pipeline(
33
 
34
  @spaces.GPU
35
  def infer(prompt):
36
- return pipe(prompt, max_new_tokens=1, do_sample=True, temperature=1.0, return_full_text=False)[0]["generated_text"]
37
 
38
  default_experiment = """You will take part in a Social Prediction Game.
39
  You will observe a Player playing against an Opponent.
@@ -53,7 +53,6 @@ with gr.Blocks(
53
  fill_width=True,
54
  css="""
55
  #prompt-box textarea {height:400px}
56
- #answer-box textarea {height:400px}
57
  #info-box {margin-bottom: 1rem} /* a little spacing */
58
  """
59
  ) as demo:
@@ -79,19 +78,16 @@ with gr.Blocks(
79
  elem_id="info-box",
80
  )
81
 
82
- # --------------------------------------
83
-
84
- with gr.Row(equal_height=True):
85
- inp = gr.Textbox(
86
- label="Prompt", elem_id="prompt-box",
87
- lines=20, max_lines=24, scale=3, value=default_experiment
88
- )
89
- outp = gr.Textbox(
90
- label="Response", elem_id="answer-box",
91
- lines=1, interactive=False, scale=3
92
- )
93
 
94
  run = gr.Button("Run")
95
- run.click(infer, inp, outp)
96
 
97
  demo.queue().launch()
 
33
 
34
  @spaces.GPU
35
  def infer(prompt):
36
+ return prompt + pipe(prompt, max_new_tokens=1, do_sample=True, temperature=1.0, return_full_text=False)[0]["generated_text"]
37
 
38
  default_experiment = """You will take part in a Social Prediction Game.
39
  You will observe a Player playing against an Opponent.
 
53
  fill_width=True,
54
  css="""
55
  #prompt-box textarea {height:400px}
 
56
  #info-box {margin-bottom: 1rem} /* a little spacing */
57
  """
58
  ) as demo:
 
78
  elem_id="info-box",
79
  )
80
 
81
+ inp = gr.Textbox(
82
+ label="Prompt",
83
+ elem_id="prompt-box",
84
+ lines=20,
85
+ max_lines=24,
86
+ scale=3,
87
+ value=default_experiment,
88
+ )
 
 
 
89
 
90
  run = gr.Button("Run")
91
+ run.click(infer, inp, inp)
92
 
93
  demo.queue().launch()