m-ric HF staff commited on
Commit
577fccd
1 Parent(s): 59fc259

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -21,7 +21,7 @@ from examples import (
21
  output_example_sf,
22
  description_loire,
23
  output_example_loire,
24
- df_examples
25
  )
26
 
27
  repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
@@ -202,11 +202,11 @@ def run_display(text):
202
  yield map, "```text\n" + current_output + "\n```"
203
 
204
 
205
- def select_example(df, data: gr.SelectData):
206
- row = df.iloc[data.index[0], :]
207
- dataframe, _ = parse_llm_output(row["output"])
208
  map = create_map_from_markers(dataframe)
209
- return row["description"], map, "```text\n" + row["output"] + "\n```"
210
 
211
 
212
  with gr.Blocks(
@@ -233,8 +233,8 @@ with gr.Blocks(
233
  button.click(run_display, inputs=[text], outputs=[map, display_thoughts])
234
 
235
  gr.Markdown("### Other examples")
236
- clickable_examples = gr.DataFrame(value=df_examples, height=200)
237
- clickable_examples.select(
238
  select_example, clickable_examples, outputs=[text, map, display_thoughts]
239
  )
240
 
 
21
  output_example_sf,
22
  description_loire,
23
  output_example_loire,
24
+ trip_examples
25
  )
26
 
27
  repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
 
202
  yield map, "```text\n" + current_output + "\n```"
203
 
204
 
205
+ def select_example(choice, data: gr.SelectData):
206
+ output = trip_examples[choice]
207
+ dataframe, _ = parse_llm_output(output)
208
  map = create_map_from_markers(dataframe)
209
+ return choice, map, "```text\n" + output + "\n```"
210
 
211
 
212
  with gr.Blocks(
 
233
  button.click(run_display, inputs=[text], outputs=[map, display_thoughts])
234
 
235
  gr.Markdown("### Other examples")
236
+ clickable_examples = gr.Dropdown(choices=trip_examples.keys())
237
+ clickable_examples.input(
238
  select_example, clickable_examples, outputs=[text, map, display_thoughts]
239
  )
240