lun0tic-j commited on
Commit
e7e4dec
Β·
verified Β·
1 Parent(s): ad123c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -4,13 +4,13 @@ import torch
4
  from transformers import pipeline
5
 
6
  # ν•œκ΅­μ–΄ -> μ˜μ–΄ λ²ˆμ—­
7
- translator = pipeline("translation_en_ko", model="Helsinki-NLP/opus-mt-ko-en")
8
- input_text = "μ•ˆλ…•ν•˜μ„Έμš”, μ—¬λŸ¬λΆ„ μ–΄λ•Œμš”?"
9
- output_text = translator(input_text)[0]["translation_text"]
10
- print(f"Input: {input_text}\nOutput: {output_text}")
11
 
12
  # μ˜μ–΄ -> ν•œκ΅­μ–΄ λ²ˆμ—­
13
- translator = pipeline("translation_en_to_ko", model="EleutherAI/pile-small-cased-v2")
14
- input_text = "Hello, how are you doing today?"
15
- output_text = translator(input_text)[0]["translation_text"]
16
- print(f"\nInput: {input_text}\nOutput: {output_text}")
 
4
  from transformers import pipeline
5
 
6
  # ν•œκ΅­μ–΄ -> μ˜μ–΄ λ²ˆμ—­
7
+ translator_ko_to_en = pipeline("translation_en_ko", model="Helsinki-NLP/opus-mt-ko-en")
8
+ input_text_ko = "μ•ˆλ…•ν•˜μ„Έμš”, μ—¬λŸ¬λΆ„ μ–΄λ•Œμš”?"
9
+ output_text_en = translator_ko_to_en(input_text_ko)[0]["translation_text"]
10
+ print(f"Korean to English\nInput: {input_text_ko}\nOutput: {output_text_en}")
11
 
12
  # μ˜μ–΄ -> ν•œκ΅­μ–΄ λ²ˆμ—­
13
+ translator_en_to_ko = pipeline("translation_en_to_ko", model="EleutherAI/pile-small-cased-v2")
14
+ input_text_en = "Hello, how are you doing today?"
15
+ output_text_ko = translator_en_to_ko(input_text_en)[0]["translation_text"]
16
+ print(f"\nEnglish to Korean\nInput: {input_text_en}\nOutput: {output_text_ko}")