Update app.py
Browse files
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()
|