Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import tensorflow as tf
|
| 3 |
from tensorflow.keras.models import load_model
|
|
|
|
| 4 |
|
| 5 |
model = load_model("romangpt.h5")
|
| 6 |
|
| 7 |
def generate_response(question):
|
| 8 |
input_data = [question]
|
| 9 |
-
input_sequence =
|
| 10 |
|
| 11 |
response = model.predict(input_sequence)[0]
|
| 12 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import tensorflow as tf
|
| 3 |
from tensorflow.keras.models import load_model
|
| 4 |
+
from tensorflow.keras.preprocessing.sequence import pad_sequences
|
| 5 |
|
| 6 |
model = load_model("romangpt.h5")
|
| 7 |
|
| 8 |
def generate_response(question):
|
| 9 |
input_data = [question]
|
| 10 |
+
input_sequence = pad_sequences(tokenizer.texts_to_sequences(input_data), maxlen=max_sequence_length-1)
|
| 11 |
|
| 12 |
response = model.predict(input_sequence)[0]
|
| 13 |
|