123 / app.py
iewniy's picture
Update app.py
08ea547 verified
raw
history blame
914 Bytes
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()