File size: 334 Bytes
5ae5dcd
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr
import json
from pathlib import Path

fileid2json = json.loads(Path("fileid2json.json").read_text())

def greet(query):
    result = "Not found"
    if query in fileid2json:
        result = fileid2json[query.strip()]
    return result

iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()