ksyint commited on
Commit
87bcb39
β€’
1 Parent(s): 16ad9a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -4,10 +4,17 @@ from PIL import Image
4
  import numpy as np
5
  import gradio as gr
6
  from trans import translate
7
- import urllib.request
8
  import os
 
9
 
10
 
 
 
 
 
 
 
 
11
  model_id = "stabilityai/stable-diffusion-xl-base-1.0"
12
  adapter_id = "ksyint/teu_lora"
13
 
 
4
  import numpy as np
5
  import gradio as gr
6
  from trans import translate
 
7
  import os
8
+ from transformers import pipeline
9
 
10
 
11
+ def translate(text):
12
+ model_checkpoint = "Helsinki-NLP/opus-mt-ko-en"
13
+ translator = pipeline("translation", model=model_checkpoint)
14
+ translated=translator(text)
15
+ translated=translated[0]["translation_text"]
16
+ return translated
17
+
18
  model_id = "stabilityai/stable-diffusion-xl-base-1.0"
19
  adapter_id = "ksyint/teu_lora"
20