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