|
import gradio as gr |
|
from get_langchain_fn import langchain_retrieval_invoke |
|
|
|
|
|
def gradio_app(): |
|
with gr.Blocks() as demo: |
|
gr.Markdown("## Video Content Retrieval") |
|
gr.Markdown("When you want to rewatch some youtube videos for a specific content but cannot find it easily, try inputting the youtube url along with the content you want to hear about") |
|
gr.Markdown("You should get the video url with the timestamp of that part, and the summary of that!") |
|
|
|
|
|
with gr.Row(): |
|
video_ids = gr.Textbox(label="Enter video url(s) separated by comma") |
|
|
|
with gr.Row(): |
|
content = gr.Textbox(label="Enter your content you want to rewatch") |
|
|
|
|
|
with gr.Row(): |
|
with gr.Column(): |
|
gr.Markdown("output url") |
|
url_output = gr.HTML(label="URL with timestamp") |
|
summary_output = gr.Textbox(label="Summary", interactive=False) |
|
|
|
|
|
submit_btn = gr.Button("Submit") |
|
|
|
|
|
examples = [['https://www.youtube.com/watch?v=wDVteayWWvU', 'Q learning using neural network which is good in case of milliions of possible states like chess game'], |
|
['https://www.youtube.com/watch?v=00jbG_cfGuQ, https://www.youtube.com/watch?v=sQK3Yr4Sc_k', 'Krebs cycle'], |
|
['https://www.youtube.com/watch?v=62wEk02YKs0', 'how caffaine actaully works'] |
|
] |
|
|
|
|
|
submit_btn.click(fn=langchain_retrieval_invoke, inputs=[video_ids, content], outputs=[url_output, summary_output]) |
|
|
|
|
|
gr.Examples(examples=examples, inputs=[video_ids, content]) |
|
|
|
return demo |
|
|
|
|
|
demo = gradio_app() |
|
demo.launch() |