Spaces:
Paused
Paused
DHRUV SHEKHAWAT
commited on
Commit
·
93c51a9
1
Parent(s):
8fa9e91
Update app.py
Browse files
app.py
CHANGED
@@ -71,27 +71,27 @@ def completion_model(vocab_size, max_len, d_model, n_head, ff_dim, dropout_rate,
|
|
71 |
chatbot.compile(optimizer="adam", loss="sparse_categorical_crossentropy")
|
72 |
|
73 |
for i in range(1):
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
output_sentence = ""
|
81 |
for _ in range(len2):
|
82 |
-
predicted_token = np.argmax(chatbot.predict(
|
83 |
predicted_token = predicted_token.item()
|
84 |
out = num_to_word[predicted_token]
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
st.title("UniGLM TEXT completion Model")
|
96 |
st.subheader("Next Word Prediction AI Model by Webraft-AI")
|
97 |
#Picking what NLP task you want to do
|
|
|
71 |
chatbot.compile(optimizer="adam", loss="sparse_categorical_crossentropy")
|
72 |
|
73 |
for i in range(1):
|
74 |
+
other_text2 = text2
|
75 |
+
other_text2 = other_text2.lower()
|
76 |
+
other_words2 = other_text2.split()
|
77 |
+
other_num2 = [word_to_num[word] for word in other_words2]
|
78 |
+
given_X2 = other_num2
|
79 |
+
input_sequence2 = pad_sequences([given_X2], maxlen=max_len, padding='post')
|
80 |
+
output_sentence = other_text2 + ""
|
81 |
for _ in range(len2):
|
82 |
+
predicted_token = np.argmax(chatbot.predict(input_sequence2), axis=-1)
|
83 |
predicted_token = predicted_token.item()
|
84 |
out = num_to_word[predicted_token]
|
85 |
+
# if out == ".":
|
86 |
+
# break
|
87 |
+
|
88 |
+
output_sentence += " " + out
|
89 |
+
given_X2 = given_X2[1:]
|
90 |
+
given_X2.append(predicted_token)
|
91 |
+
input_sequence2 = pad_sequences([given_X2], maxlen=max_len, padding='post')
|
92 |
|
93 |
+
out2 = output_sentence
|
94 |
+
return out2
|
95 |
st.title("UniGLM TEXT completion Model")
|
96 |
st.subheader("Next Word Prediction AI Model by Webraft-AI")
|
97 |
#Picking what NLP task you want to do
|