dictionary / app.py
snet's picture
initial commit
f4677f9
raw
history blame contribute delete
415 Bytes
import requests
import gradio as gr
def lookup(word):
url = f"https://www.moedict.tw/uni/{word}"
data = requests.get(url).json()
return data['heteronyms'][0]['definitions'][0]['def']
gr.Interface(lookup,
gr.Textbox(label="輸入國字或詞語"),
'text',
title="國語字典",
description="請輸入欲查詢之國字或詞語並按下submit!").launch()