Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
import gradio as gr
|
3 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
4 |
from nltk.tokenize import sent_tokenize
|
5 |
-
from konlpy.tag import Kkma
|
6 |
import gc
|
7 |
|
8 |
import nltk
|
@@ -62,7 +61,7 @@ def split_sent(sentences, pipe, max_len=256):
|
|
62 |
# %%
|
63 |
def translate(text, lang, gpt_fix=False):
|
64 |
from_en = False if lang == 'νμ' else True
|
65 |
-
sentences = sent_tokenize(text)
|
66 |
#print(sentences)
|
67 |
if not sentences:
|
68 |
return ''
|
@@ -115,7 +114,7 @@ def translate_with_sum(text, lang, gpt_fix=False):
|
|
115 |
summary = en_sum(text, max_length=int(len_tokens(text, en_sum)/2)+32)
|
116 |
text = summary[0]['summary_text']
|
117 |
|
118 |
-
sentences = sent_tokenize(text)
|
119 |
#print(sentences)
|
120 |
if not sentences:
|
121 |
return ''
|
@@ -146,7 +145,7 @@ def summarize(text, lang):
|
|
146 |
return summary
|
147 |
|
148 |
def translate_styleonly(text):
|
149 |
-
sentences =
|
150 |
paragraphs = split_sent(sentences, style_pipe, max_len=180)
|
151 |
#print(paragraphs)
|
152 |
|
|
|
2 |
import gradio as gr
|
3 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
4 |
from nltk.tokenize import sent_tokenize
|
|
|
5 |
import gc
|
6 |
|
7 |
import nltk
|
|
|
61 |
# %%
|
62 |
def translate(text, lang, gpt_fix=False):
|
63 |
from_en = False if lang == 'νμ' else True
|
64 |
+
sentences = sent_tokenize(text)
|
65 |
#print(sentences)
|
66 |
if not sentences:
|
67 |
return ''
|
|
|
114 |
summary = en_sum(text, max_length=int(len_tokens(text, en_sum)/2)+32)
|
115 |
text = summary[0]['summary_text']
|
116 |
|
117 |
+
sentences = sent_tokenize(text)
|
118 |
#print(sentences)
|
119 |
if not sentences:
|
120 |
return ''
|
|
|
145 |
return summary
|
146 |
|
147 |
def translate_styleonly(text):
|
148 |
+
sentences = sent_tokenize(text)
|
149 |
paragraphs = split_sent(sentences, style_pipe, max_len=180)
|
150 |
#print(paragraphs)
|
151 |
|