james0430 commited on
Commit
300f233
1 Parent(s): b54fc12

first version

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ def lookup(word):
3
+ url = f"https://www.moedict.tw/uni/{word}"
4
+ data = requests.get(url).json()
5
+ return data['heteronyms'][0]['definitions'][0]['def']
6
+ gr.Interface(lookup,
7
+ 'text',
8
+ 'text',
9
+ title="國語字典",
10
+ description="請輸入欲查詢之國字或詞語並按下submit!").launch()