'
if sources is not None and len(sources) > 0:
sources = [s.strip() for s in sources.split(',')]
for source in sources:
embed_video_html += f'''
'''
return answer, embed_video_html+'
'
examples = [
"Describe Serena Williams game style in details.",
"What should I do to improve my forehand groundstroke? Describe the motions step by step.",
"Compare Serena and Venus game style in details. Who is better?",
"Compare Novak and Nadal gamestyle in details. Who is better?",
"Who is the tennis GOAT?",
"Who in the young generation will be next great tennis player? Explain in details.",
"Which American tennis player will win a grand slam in the future?",
"Can you help me improve my two handed backhand? I want to hit the balls with more spin and power.",
"How should I coach a junior tennis player to be next Serena?",
"What is mental toughness? Explain in details.",
"How can I train mental toughness?"
]
def process_example(args):
for x in generate(args):
pass
return x
css = ".generating {visibility: hidden}"
monospace_css = """
#q-input textarea {
font-family: monospace, 'Consolas', Courier, monospace;
}
"""
css += monospace_css + ".gradio-container {color: black}"
description = """
Ask Tennis Coach Rick Macci
This is a demo to answer some popular questions from tennis fans to Coach Rick. The information is being extracted from his official Youtube channel. It's using the following technologies:
Google PALM
Gradio
hkunlp/instructor-xl
HuggingFace
Langchain
Pinecone
"""
disclaimer = """⚠️This is an unofficial website.\
**Intended Use**: this app for demonstration purposes; not to serve as replacement for Coach Rick official media channels or personal expertise."""
with gr.Blocks(theme=theme, analytics_enabled=False, css=css) as demo:
with gr.Column():
gr.Markdown(description)
gr.Markdown(disclaimer)
with gr.Row():
with gr.Column():
question = gr.Textbox(
placeholder="Enter your question here",
lines=5,
label="Question"
)
submit = gr.Button("Ask", variant="primary")
output = gr.Textbox(elem_id="q-output", lines=10, label="Answer")
video = gr.HTML('')
gr.Examples(
examples=examples,
inputs=[question],
cache_examples=False,
fn=process_example,
outputs=[output, video],
)
submit.click(
generate,
inputs=[question],
outputs=[output, video],
)
demo.queue(concurrency_count=16).launch(debug=True)