Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from gradio_client import Client | |
| def translate_text(text): | |
| """ | |
| ์ ๋ ฅ๋ ํ ์คํธ๋ฅผ ํ๊น ํ์ด์ค์ ๊ทธ๋ผ๋์ค API๋ฅผ ํตํด ๋ฒ์ญํฉ๋๋ค. | |
| API ์๋ํฌ์ธํธ๋ "Kims12/4-1_EK_translate"์ด๋ฉฐ, | |
| ์๋์ผ๋ก ์์ด์ ํ๊ตญ์ด๋ฅผ ๊ฐ์งํ์ฌ ์๋ฐฉํฅ ๋ฒ์ญ์ ์ํํฉ๋๋ค. | |
| """ | |
| client = Client("Kims12/4-1_EK_translate") | |
| result = client.predict(text=text, api_name="/predict") | |
| return result | |
| # Gradio ์ธํฐํ์ด์ค ์ ์ | |
| iface = gr.Interface( | |
| fn=translate_text, | |
| inputs=gr.Textbox(lines=5, placeholder="๋ฒ์ญํ ํ ์คํธ๋ฅผ ์ ๋ ฅํ์ธ์.", label="์ ๋ ฅ ํ ์คํธ"), | |
| outputs=gr.Textbox(label="๋ฒ์ญ ๊ฒฐ๊ณผ"), | |
| title="์์ด-ํ๊ตญ์ด ์๋ฐฉํฅ ๋ฒ์ญ๊ธฐ", | |
| description="์ ๋ ฅํ ํ ์คํธ๋ฅผ ์์ด์ ํ๊ตญ์ด ๊ฐ์ ๋ฒ์ญํฉ๋๋ค. (ํ๊น ํ์ด์ค ๊ทธ๋ผ๋์ค API๋ฅผ ์ฌ์ฉํฉ๋๋ค.)" | |
| ) | |
| if __name__ == "__main__": | |
| iface.launch() | |