Update app.py
Browse files
app.py
CHANGED
@@ -14,8 +14,6 @@ for package, version in installed_packages.items():
|
|
14 |
print(f"{package}=={version}")
|
15 |
'''
|
16 |
|
17 |
-
bot_input_ids = None
|
18 |
-
|
19 |
# Load the chatbot model
|
20 |
chatbot_model_name = "microsoft/DialoGPT-medium"
|
21 |
chatbot_tokenizer = AutoTokenizer.from_pretrained(chatbot_model_name)
|
@@ -37,6 +35,7 @@ data = {
|
|
37 |
}
|
38 |
table = pd.DataFrame.from_dict(data)
|
39 |
|
|
|
40 |
|
41 |
def chatbot_response(user_message):
|
42 |
# Generate chatbot response using the chatbot model
|
@@ -44,6 +43,7 @@ def chatbot_response(user_message):
|
|
44 |
#outputs = chatbot_model.generate(inputs, max_length=100, num_return_sequences=1)
|
45 |
#response = chatbot_tokenizer.decode(outputs[0], skip_special_tokens=True)
|
46 |
|
|
|
47 |
# encode the new user input, add the eos_token and return a tensor in Pytorch
|
48 |
new_user_input_ids = chatbot_tokenizer.encode(user_message + tokenizer.eos_token, return_tensors='pt')
|
49 |
|
|
|
14 |
print(f"{package}=={version}")
|
15 |
'''
|
16 |
|
|
|
|
|
17 |
# Load the chatbot model
|
18 |
chatbot_model_name = "microsoft/DialoGPT-medium"
|
19 |
chatbot_tokenizer = AutoTokenizer.from_pretrained(chatbot_model_name)
|
|
|
35 |
}
|
36 |
table = pd.DataFrame.from_dict(data)
|
37 |
|
38 |
+
bot_input_ids = None
|
39 |
|
40 |
def chatbot_response(user_message):
|
41 |
# Generate chatbot response using the chatbot model
|
|
|
43 |
#outputs = chatbot_model.generate(inputs, max_length=100, num_return_sequences=1)
|
44 |
#response = chatbot_tokenizer.decode(outputs[0], skip_special_tokens=True)
|
45 |
|
46 |
+
global bot_input_ids
|
47 |
# encode the new user input, add the eos_token and return a tensor in Pytorch
|
48 |
new_user_input_ids = chatbot_tokenizer.encode(user_message + tokenizer.eos_token, return_tensors='pt')
|
49 |
|