Kims12 commited on
Commit
e7a27a4
ยท
verified ยท
1 Parent(s): fb9ee93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -12
app.py CHANGED
@@ -27,18 +27,40 @@ def translate_to_korean(english_text):
27
  return f"์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: {str(e)}"
28
 
29
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์„ฑ
30
- iface = gr.Interface(
31
- fn=translate_to_korean,
32
- inputs=gr.inputs.Textbox(lines=10, placeholder="๋ฒˆ์—ญํ•  ์˜์–ด ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”..."),
33
- outputs=gr.outputs.Textbox(),
34
- title="์˜์–ด-ํ•œ๊ตญ์–ด ๋ฒˆ์—ญ๊ธฐ",
35
- description="GPT-4o-mini ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์˜์–ด ํ…์ŠคํŠธ๋ฅผ ํ•œ๊ตญ์–ด๋กœ ๋ฒˆ์—ญํ•ฉ๋‹ˆ๋‹ค.",
36
- examples=[
37
- ["Hello, how are you?"],
38
- ["This is a test sentence for translation."],
39
- ["OpenAI provides powerful language models."]
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()