Skip to content

Commit

Permalink
more/random examples
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed May 26, 2024
1 parent 87efb44 commit 5968c78
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import gradio as gr
import random
from backend.utils import (
generate_quiz,
get_closed_book_answers,
Expand Down Expand Up @@ -182,9 +183,24 @@ def compute_display_web_rag(quiz):
"https://en.wikipedia.org/wiki/The_Cure",
"https://en.wikipedia.org/wiki/Masters_of_Doom",
"https://www.rainforest-alliance.org/species/howler-monkey/",
"https://lite.cnn.com/2024/05/23/travel/star-wars-hotel-disney-jenny-nicholson-cec/index.html"
"https://lite.cnn.com/2024/05/23/travel/star-wars-hotel-disney-jenny-nicholson-cec/index.html",
"https://en.wikipedia.org/wiki/Indiana_Jones_(character)",
"https://www.rainforest-alliance.org/species/river-dolphin/",
"https://www.rainforest-alliance.org/species/sloth/",
"https://www.rainforest-alliance.org/species/honduran-bat/",
"https://en.wikipedia.org/wiki/Joel_Breman",
"https://en.wikipedia.org/wiki/Neffa",
"https://lite.cnn.com/2024/05/25/us/primate-escape-walterboro-south-carolina/index.html",
"https://en.wikipedia.org/wiki/John_McCain",
"https://lite.cnn.com/2024/05/17/tech/neuralink-trial-participant-elon-musk-noland-arbaugh/index.html",
"https://lite.cnn.com/2024/05/17/tech/ai-high-school/index.html",
"https://en.wikipedia.org/wiki/Drake%E2%80%93Kendrick_Lamar_feud",
"https://en.wikipedia.org/wiki/Fiat_Panda",
"https://lite.cnn.com/2024/05/13/tech/openai-altman-new-ai-model-gpt-4o/index.html",
]

examples_to_show = random.sample(URL_EXAMPLES, 5)

with open("README.md", "r") as fin:
info_md = (
fin.read()
Expand All @@ -203,7 +219,7 @@ def compute_display_web_rag(quiz):
with gr.Row():
url = gr.Textbox(
label="URL from which to generate a quiz",
value=URL_EXAMPLES[0],
value=examples_to_show[0],
interactive=True,
max_lines=1,
)
Expand All @@ -212,7 +228,7 @@ def compute_display_web_rag(quiz):
)

examples = gr.Examples(
examples=URL_EXAMPLES,
examples=examples_to_show,
inputs=[url],
label=["Example URLs"],
)
Expand Down

0 comments on commit 5968c78

Please sign in to comment.