Spaces:
Sleeping
Sleeping
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() |