Spaces:
Running
Running
ipdssanggau
commited on
Commit
•
be9658d
1
Parent(s):
1ca919c
condition chatbot
Browse files
app.py
CHANGED
@@ -39,7 +39,7 @@ def retrieve_answer(user_question):
|
|
39 |
|
40 |
# Generate response using XGLM
|
41 |
def generate_response(user_input, retrieved_answer):
|
42 |
-
input_text = f"{retrieved_answer}"
|
43 |
inputs = tokenizer(input_text, return_tensors="pt")
|
44 |
outputs = model.generate(
|
45 |
inputs['input_ids'],
|
@@ -70,7 +70,7 @@ def chatbot_response(user_input):
|
|
70 |
if user_input:
|
71 |
retrieved_answer = retrieve_answer(user_input)
|
72 |
response = generate_response(user_input, retrieved_answer)
|
73 |
-
return f"
|
74 |
|
75 |
def chat_interface(user_input, history=[]):
|
76 |
history.append(("Anda: " + user_input, "Chatbot: " + chatbot_response(user_input)))
|
|
|
39 |
|
40 |
# Generate response using XGLM
|
41 |
def generate_response(user_input, retrieved_answer):
|
42 |
+
input_text = f"pertanyaan: {user_input}, jawaban: {retrieved_answer}"
|
43 |
inputs = tokenizer(input_text, return_tensors="pt")
|
44 |
outputs = model.generate(
|
45 |
inputs['input_ids'],
|
|
|
70 |
if user_input:
|
71 |
retrieved_answer = retrieve_answer(user_input)
|
72 |
response = generate_response(user_input, retrieved_answer)
|
73 |
+
return f"{response}\n\nRetrieved Answer: {retrieved_answer}"
|
74 |
|
75 |
def chat_interface(user_input, history=[]):
|
76 |
history.append(("Anda: " + user_input, "Chatbot: " + chatbot_response(user_input)))
|