Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,18 +27,40 @@ def translate_to_korean(english_text):
|
|
| 27 |
return f"์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค: {str(e)}"
|
| 28 |
|
| 29 |
# Gradio ์ธํฐํ์ด์ค ๊ตฌ์ฑ
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
if __name__ == "__main__":
|
| 44 |
iface.launch()
|
|
|
|
| 27 |
return f"์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค: {str(e)}"
|
| 28 |
|
| 29 |
# Gradio ์ธํฐํ์ด์ค ๊ตฌ์ฑ
|
| 30 |
+
with gr.Blocks() as iface:
|
| 31 |
+
gr.Markdown("# ์์ด-ํ๊ตญ์ด ๋ฒ์ญ๊ธฐ")
|
| 32 |
+
gr.Markdown("GPT-4o-mini ๋ชจ๋ธ์ ์ฌ์ฉํ์ฌ ์์ด ํ
์คํธ๋ฅผ ํ๊ตญ์ด๋ก ๋ฒ์ญํฉ๋๋ค.")
|
| 33 |
+
|
| 34 |
+
with gr.Row():
|
| 35 |
+
with gr.Column():
|
| 36 |
+
english_input = gr.Textbox(
|
| 37 |
+
lines=10,
|
| 38 |
+
placeholder="๋ฒ์ญํ ์์ด ํ
์คํธ๋ฅผ ์
๋ ฅํ์ธ์...",
|
| 39 |
+
label="์์ด ํ
์คํธ"
|
| 40 |
+
)
|
| 41 |
+
with gr.Column():
|
| 42 |
+
korean_output = gr.Textbox(
|
| 43 |
+
lines=10,
|
| 44 |
+
label="ํ๊ตญ์ด ๋ฒ์ญ"
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
translate_button = gr.Button("๋ฒ์ญํ๊ธฐ")
|
| 48 |
+
|
| 49 |
+
translate_button.click(
|
| 50 |
+
fn=translate_to_korean,
|
| 51 |
+
inputs=english_input,
|
| 52 |
+
outputs=korean_output
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
gr.Examples(
|
| 56 |
+
examples=[
|
| 57 |
+
"Hello, how are you?",
|
| 58 |
+
"This is a test sentence for translation.",
|
| 59 |
+
"OpenAI provides powerful language models."
|
| 60 |
+
],
|
| 61 |
+
inputs=english_input,
|
| 62 |
+
outputs=korean_output
|
| 63 |
+
)
|
| 64 |
|
| 65 |
if __name__ == "__main__":
|
| 66 |
iface.launch()
|