Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ def translate(input, output, text):
|
|
| 25 |
"early_stopping": False,
|
| 26 |
"length_penalty": 0.0,
|
| 27 |
"eos_token_id": None,
|
| 28 |
-
"max_new_tokens":
|
| 29 |
"top_p": 0.9,
|
| 30 |
},
|
| 31 |
"options": {
|
|
@@ -34,9 +34,9 @@ def translate(input, output, text):
|
|
| 34 |
},
|
| 35 |
}
|
| 36 |
response = requests.request("POST", API_URL, json=json_)
|
| 37 |
-
output = response.json()
|
| 38 |
|
| 39 |
-
return output
|
| 40 |
|
| 41 |
demo = gr.Blocks()
|
| 42 |
|
|
|
|
| 25 |
"early_stopping": False,
|
| 26 |
"length_penalty": 0.0,
|
| 27 |
"eos_token_id": None,
|
| 28 |
+
"max_new_tokens": 250,
|
| 29 |
"top_p": 0.9,
|
| 30 |
},
|
| 31 |
"options": {
|
|
|
|
| 34 |
},
|
| 35 |
}
|
| 36 |
response = requests.request("POST", API_URL, json=json_)
|
| 37 |
+
output = response.json()[0]['generated_text']
|
| 38 |
|
| 39 |
+
return output.replace(instruction, '', 1)
|
| 40 |
|
| 41 |
demo = gr.Blocks()
|
| 42 |
|