fileid以外からの逆引きに対応
Browse files
app.py
CHANGED
@@ -4,10 +4,24 @@ from pathlib import Path
|
|
4 |
|
5 |
fileid2json = json.loads(Path("fileid2json.json").read_text())
|
6 |
|
|
|
|
|
|
|
|
|
|
|
7 |
def greet(query):
|
8 |
result = "Not found"
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
return result
|
12 |
|
13 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
|
|
4 |
|
5 |
fileid2json = json.loads(Path("fileid2json.json").read_text())
|
6 |
|
7 |
+
autov22fileid = json.loads(Path("autov22fileid.json").read_text())
|
8 |
+
filename2fileid = json.loads(Path("filename2fileid.json").read_text())
|
9 |
+
name2fileid = json.loads(Path("name2fileid.json").read_text())
|
10 |
+
|
11 |
+
|
12 |
def greet(query):
|
13 |
result = "Not found"
|
14 |
+
fileid = query
|
15 |
+
|
16 |
+
if query in autov22fileid:
|
17 |
+
fileid = autov22fileid[query]
|
18 |
+
if query in filename2fileid:
|
19 |
+
fileid = filename2fileid[query]
|
20 |
+
if query in name2fileid:
|
21 |
+
fileid = name2fileid[query]
|
22 |
+
|
23 |
+
if fileid in fileid2json:
|
24 |
+
result = json.dumps(fileid2json[query.strip()])
|
25 |
return result
|
26 |
|
27 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|