anakin87 commited on
Commit
5968c78
Β·
1 Parent(s): 87efb44

more/random examples

Browse files
Files changed (1) hide show
  1. app.py +19 -3
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  from backend.utils import (
3
  generate_quiz,
4
  get_closed_book_answers,
@@ -182,9 +183,24 @@ URL_EXAMPLES = [
182
  "https://en.wikipedia.org/wiki/The_Cure",
183
  "https://en.wikipedia.org/wiki/Masters_of_Doom",
184
  "https://www.rainforest-alliance.org/species/howler-monkey/",
185
- "https://lite.cnn.com/2024/05/23/travel/star-wars-hotel-disney-jenny-nicholson-cec/index.html"
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  ]
187
 
 
 
188
  with open("README.md", "r") as fin:
189
  info_md = (
190
  fin.read()
@@ -203,7 +219,7 @@ with gr.Blocks(
203
  with gr.Row():
204
  url = gr.Textbox(
205
  label="URL from which to generate a quiz",
206
- value=URL_EXAMPLES[0],
207
  interactive=True,
208
  max_lines=1,
209
  )
@@ -212,7 +228,7 @@ with gr.Blocks(
212
  )
213
 
214
  examples = gr.Examples(
215
- examples=URL_EXAMPLES,
216
  inputs=[url],
217
  label=["Example URLs"],
218
  )
 
1
  import gradio as gr
2
+ import random
3
  from backend.utils import (
4
  generate_quiz,
5
  get_closed_book_answers,
 
183
  "https://en.wikipedia.org/wiki/The_Cure",
184
  "https://en.wikipedia.org/wiki/Masters_of_Doom",
185
  "https://www.rainforest-alliance.org/species/howler-monkey/",
186
+ "https://lite.cnn.com/2024/05/23/travel/star-wars-hotel-disney-jenny-nicholson-cec/index.html",
187
+ "https://en.wikipedia.org/wiki/Indiana_Jones_(character)",
188
+ "https://www.rainforest-alliance.org/species/river-dolphin/",
189
+ "https://www.rainforest-alliance.org/species/sloth/",
190
+ "https://www.rainforest-alliance.org/species/honduran-bat/",
191
+ "https://en.wikipedia.org/wiki/Joel_Breman",
192
+ "https://en.wikipedia.org/wiki/Neffa",
193
+ "https://lite.cnn.com/2024/05/25/us/primate-escape-walterboro-south-carolina/index.html",
194
+ "https://en.wikipedia.org/wiki/John_McCain",
195
+ "https://lite.cnn.com/2024/05/17/tech/neuralink-trial-participant-elon-musk-noland-arbaugh/index.html",
196
+ "https://lite.cnn.com/2024/05/17/tech/ai-high-school/index.html",
197
+ "https://en.wikipedia.org/wiki/Drake%E2%80%93Kendrick_Lamar_feud",
198
+ "https://en.wikipedia.org/wiki/Fiat_Panda",
199
+ "https://lite.cnn.com/2024/05/13/tech/openai-altman-new-ai-model-gpt-4o/index.html",
200
  ]
201
 
202
+ examples_to_show = random.sample(URL_EXAMPLES, 5)
203
+
204
  with open("README.md", "r") as fin:
205
  info_md = (
206
  fin.read()
 
219
  with gr.Row():
220
  url = gr.Textbox(
221
  label="URL from which to generate a quiz",
222
+ value=examples_to_show[0],
223
  interactive=True,
224
  max_lines=1,
225
  )
 
228
  )
229
 
230
  examples = gr.Examples(
231
+ examples=examples_to_show,
232
  inputs=[url],
233
  label=["Example URLs"],
234
  )