Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -64,10 +64,9 @@ def split_text_into_chunks(text, chunk_size=500):
|
|
64 |
return chunks
|
65 |
|
66 |
def translation(source, target, text):
|
67 |
-
response =
|
68 |
chunks = split_text_into_chunks(text)
|
69 |
for chunk in chunks:
|
70 |
-
response = ""
|
71 |
try:
|
72 |
input_prompt = bloom_template.replace("{source}", source)
|
73 |
input_prompt = input_prompt.replace("{target}", target)
|
@@ -79,6 +78,7 @@ def translation(source, target, text):
|
|
79 |
except Exception as e:
|
80 |
print(f"ERROR: LLM show {e}")
|
81 |
response = response.strip()
|
|
|
82 |
return response
|
83 |
|
84 |
gr.Interface(translation, inputs=["text","text","text"], outputs="text").launch()
|
|
|
64 |
return chunks
|
65 |
|
66 |
def translation(source, target, text):
|
67 |
+
response = ""
|
68 |
chunks = split_text_into_chunks(text)
|
69 |
for chunk in chunks:
|
|
|
70 |
try:
|
71 |
input_prompt = bloom_template.replace("{source}", source)
|
72 |
input_prompt = input_prompt.replace("{target}", target)
|
|
|
78 |
except Exception as e:
|
79 |
print(f"ERROR: LLM show {e}")
|
80 |
response = response.strip()
|
81 |
+
if response == "": response = text
|
82 |
return response
|
83 |
|
84 |
gr.Interface(translation, inputs=["text","text","text"], outputs="text").launch()
|