import gradio as gr import time ko2enDict = { "사과":"apple", "사자":"lion", "사랑":"love" } en2koDict = { "apple":"사과", "lion":"사자", "love":"사랑" } dict = {"ko2en":ko2enDict, "en2ko":en2koDict} def trans(type, word): return dict[type][word] app = gr.Interface( fn=trans, inputs=[gr.Radio(["ko2en", "en2ko"]), gr.Textbox(placeholder="검색어")], outputs="text", examples=[["ko2en", "사자"]], allow_flagging="auto" ) app.launch()