Update app.py
Browse files
app.py
CHANGED
@@ -306,6 +306,10 @@ def get_response(input_text):
|
|
306 |
model_inputs = tokenizer(input_text, return_tensors="pt")
|
307 |
generated_tokens = model.generate(**model_inputs,forced_bos_token_id=tokenizer.lang_code_to_id["en_XX"])
|
308 |
translation = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
|
|
|
|
|
|
|
|
|
309 |
|
310 |
|
311 |
|
@@ -321,7 +325,7 @@ def get_response(input_text):
|
|
321 |
#if sentence== "quit":
|
322 |
#break
|
323 |
|
324 |
-
sentence= tokenize(
|
325 |
X = bag_of_words(sentence, all_words)
|
326 |
X = X.reshape(1, X.shape[0])
|
327 |
X = torch.from_numpy(X).to(device)
|
|
|
306 |
model_inputs = tokenizer(input_text, return_tensors="pt")
|
307 |
generated_tokens = model.generate(**model_inputs,forced_bos_token_id=tokenizer.lang_code_to_id["en_XX"])
|
308 |
translation = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
|
309 |
+
#list1=["Welcome","To","Tutorials","Point"]
|
310 |
+
#string1="".join(map(str,list1))
|
311 |
+
string2=" ".join(map(str,translation))
|
312 |
+
#print(string2)
|
313 |
|
314 |
|
315 |
|
|
|
325 |
#if sentence== "quit":
|
326 |
#break
|
327 |
|
328 |
+
sentence= tokenize(string2)
|
329 |
X = bag_of_words(sentence, all_words)
|
330 |
X = X.reshape(1, X.shape[0])
|
331 |
X = torch.from_numpy(X).to(device)
|