File size: 914 Bytes
08ea547 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import gradio as gr
import random
# ๅฎ็พฉไธๅ็ฐกๅฎ็ๅฝๆธไพ็ๆ้ก็ฎ
def generate_questions(video_url):
questions = []
for i in range(10):
questions.append(f"ๅ้ก {i+1} ๅ็น้ๅๅฝฑ็๏ผ{video_url}๏ผ็ๆๅ้่ฆ้ป")
return questions
# ไฝฟ็จ Gradio ๅปบ็ซ็้ข
def interface():
with gr.Blocks() as demo:
gr.Markdown("## ๅฝฑ็็ฟ้ก็ข็ๅจ")
# ่ผธๅ
ฅๅฝฑ็้ฃ็ต
video_url = gr.Textbox(label="ๅฝฑ็้ฃ็ต")
# ็ๆ้ก็ฎๆ้
generate_btn = gr.Button("็ๆ้ก็ฎ")
# ้กฏ็คบ็ๆ็้ก็ฎ
questions_output = gr.Textbox(label="็ๆ็้ก็ฎ", lines=10)
# ้ปๆๆ้ๆ๏ผ็ๆ้ก็ฎ
generate_btn.click(fn=generate_questions, inputs=video_url, outputs=questions_output)
return demo
# ้่ก Gradio ๆ็จ
demo = interface()
demo.launch()
|