DHRUV SHEKHAWAT
commited on
Commit
·
f4fcfa8
1
Parent(s):
2184c1a
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ from torch.utils.data import Dataset
|
|
| 5 |
import torch.utils.data
|
| 6 |
from models import *
|
| 7 |
from utils import *
|
| 8 |
-
st.title("UniLM
|
| 9 |
st.subheader("AI language chatbot by Webraft-AI")
|
| 10 |
#Picking what NLP task you want to do
|
| 11 |
|
|
@@ -14,7 +14,7 @@ st.subheader("Start the conversation")
|
|
| 14 |
text2 = st.text_input('Human: ') #text is stored in this variable
|
| 15 |
|
| 16 |
load_checkpoint = True
|
| 17 |
-
ckpt_path = '
|
| 18 |
with open('WORDMAP_corpus.json', 'r') as j:
|
| 19 |
word_map = json.load(j)
|
| 20 |
|
|
@@ -65,7 +65,7 @@ def remove_punc(string):
|
|
| 65 |
return no_punct.lower()
|
| 66 |
question = remove_punc(text2)
|
| 67 |
|
| 68 |
-
max_len =
|
| 69 |
enc_qus = [word_map.get(word, word_map['<unk>']) for word in question.split()]
|
| 70 |
question = torch.LongTensor(enc_qus).to(device).unsqueeze(0)
|
| 71 |
question_mask = (question!=0).to(device).unsqueeze(1).unsqueeze(1)
|
|
|
|
| 5 |
import torch.utils.data
|
| 6 |
from models import *
|
| 7 |
from utils import *
|
| 8 |
+
st.title("UniLM Beta Testing")
|
| 9 |
st.subheader("AI language chatbot by Webraft-AI")
|
| 10 |
#Picking what NLP task you want to do
|
| 11 |
|
|
|
|
| 14 |
text2 = st.text_input('Human: ') #text is stored in this variable
|
| 15 |
|
| 16 |
load_checkpoint = True
|
| 17 |
+
ckpt_path = 'checkpoint_190.pth.tar'
|
| 18 |
with open('WORDMAP_corpus.json', 'r') as j:
|
| 19 |
word_map = json.load(j)
|
| 20 |
|
|
|
|
| 65 |
return no_punct.lower()
|
| 66 |
question = remove_punc(text2)
|
| 67 |
|
| 68 |
+
max_len = 153
|
| 69 |
enc_qus = [word_map.get(word, word_map['<unk>']) for word in question.split()]
|
| 70 |
question = torch.LongTensor(enc_qus).to(device).unsqueeze(0)
|
| 71 |
question_mask = (question!=0).to(device).unsqueeze(1).unsqueeze(1)
|