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()