Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,6 +62,8 @@ def translate(
|
|
| 62 |
|
| 63 |
prompt = Prompt_template(source_text, source_lang, target_lang)
|
| 64 |
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(model.device)
|
|
|
|
|
|
|
| 65 |
|
| 66 |
generate_kwargs = dict(
|
| 67 |
input_ids=input_ids,
|
|
@@ -76,7 +78,7 @@ def translate(
|
|
| 76 |
|
| 77 |
print(resp)
|
| 78 |
|
| 79 |
-
yield resp
|
| 80 |
|
| 81 |
CSS = """
|
| 82 |
h1 {
|
|
|
|
| 62 |
|
| 63 |
prompt = Prompt_template(source_text, source_lang, target_lang)
|
| 64 |
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(model.device)
|
| 65 |
+
|
| 66 |
+
prompt_length = input_ids.shape[1]
|
| 67 |
|
| 68 |
generate_kwargs = dict(
|
| 69 |
input_ids=input_ids,
|
|
|
|
| 78 |
|
| 79 |
print(resp)
|
| 80 |
|
| 81 |
+
yield resp[prompt_length:]
|
| 82 |
|
| 83 |
CSS = """
|
| 84 |
h1 {
|