iewniy commited on
Commit
08ea547
โ€ข
1 Parent(s): ea75923

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py CHANGED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+
4
+ # ๅฎš็พฉไธ€ๅ€‹็ฐกๅ–ฎ็š„ๅ‡ฝๆ•ธไพ†็”Ÿๆˆ้กŒ็›ฎ
5
+ def generate_questions(video_url):
6
+ questions = []
7
+ for i in range(10):
8
+ questions.append(f"ๅ•้กŒ {i+1} ๅœ็นž้€™ๅ€‹ๅฝฑ็‰‡๏ผˆ{video_url}๏ผ‰็š„ๆŸๅ€‹้‡่ฆ้ปž")
9
+ return questions
10
+
11
+ # ไฝฟ็”จ Gradio ๅปบ็ซ‹็•Œ้ข
12
+ def interface():
13
+ with gr.Blocks() as demo:
14
+ gr.Markdown("## ๅฝฑ็‰‡็ฟ’้กŒ็”ข็”Ÿๅ™จ")
15
+
16
+ # ่ผธๅ…ฅๅฝฑ็‰‡้€ฃ็ต
17
+ video_url = gr.Textbox(label="ๅฝฑ็‰‡้€ฃ็ต")
18
+
19
+ # ็”Ÿๆˆ้กŒ็›ฎๆŒ‰้ˆ•
20
+ generate_btn = gr.Button("็”Ÿๆˆ้กŒ็›ฎ")
21
+
22
+ # ้กฏ็คบ็”Ÿๆˆ็š„้กŒ็›ฎ
23
+ questions_output = gr.Textbox(label="็”Ÿๆˆ็š„้กŒ็›ฎ", lines=10)
24
+
25
+ # ้ปžๆ“ŠๆŒ‰้ˆ•ๆ™‚๏ผŒ็”Ÿๆˆ้กŒ็›ฎ
26
+ generate_btn.click(fn=generate_questions, inputs=video_url, outputs=questions_output)
27
+
28
+ return demo
29
+
30
+ # ้‹่กŒ Gradio ๆ‡‰็”จ
31
+ demo = interface()
32
+ demo.launch()