KvrParaskevi
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -29,19 +29,17 @@ llm = HuggingFaceEndpoint(
|
|
29 |
|
30 |
def chat_template_prompt():
|
31 |
template = """
|
32 |
-
Do not repeat questions and do not generate answer for user/human.
|
33 |
|
34 |
-
You are a helpful hotel booking asssitant.
|
35 |
-
Below is an instruction that describes a task.
|
36 |
-
|
37 |
-
Reply with the most helpful and logic answer. During the conversation you need to ask the user
|
38 |
-
the following questions to complete the hotel booking task.
|
39 |
1) Where would you like to stay and when?
|
40 |
2) How many people are staying in the room?
|
41 |
3) Do you prefer any ammenities like breakfast included or gym?
|
42 |
4) What is your name, your email address and phone number?
|
43 |
-
|
44 |
-
|
45 |
|
46 |
{history}
|
47 |
|
@@ -60,15 +58,13 @@ def chain():
|
|
60 |
memory.load_memory_variables({}) #Initialize memory
|
61 |
return llm_chain
|
62 |
|
63 |
-
llm_chaim = chain()
|
64 |
-
|
65 |
@spaces.GPU
|
66 |
def chat_output(message, history):
|
67 |
-
result =
|
68 |
return result
|
69 |
|
70 |
with gr.Blocks() as demo:
|
71 |
-
|
72 |
#chatbot_component = gr.Chatbot(height=300, label = "history")
|
73 |
#textbox_component = gr.Textbox(placeholder="Can I help you to book a hotel?", container=False, label = "input", scale=7)
|
74 |
|
|
|
29 |
|
30 |
def chat_template_prompt():
|
31 |
template = """
|
32 |
+
Do not repeat questions and do not generate answer for user/human.Do not repeat yourself and do not create/generate dialogues.
|
33 |
|
34 |
+
You are a helpful hotel booking asssitant and you generate a response only for the assistant.
|
35 |
+
Below is an instruction that describes a task. During the conversation you need to ask the user
|
36 |
+
the following questions to complete the hotel booking task. After each of the following questions you wait for the response by the user.
|
|
|
|
|
37 |
1) Where would you like to stay and when?
|
38 |
2) How many people are staying in the room?
|
39 |
3) Do you prefer any ammenities like breakfast included or gym?
|
40 |
4) What is your name, your email address and phone number?
|
41 |
+
If the user wants to book the room, you confirm the booking otherwise you respond with "Thank, you. Please let me know if there is
|
42 |
+
any other way to assist you?"
|
43 |
|
44 |
{history}
|
45 |
|
|
|
58 |
memory.load_memory_variables({}) #Initialize memory
|
59 |
return llm_chain
|
60 |
|
|
|
|
|
61 |
@spaces.GPU
|
62 |
def chat_output(message, history):
|
63 |
+
result = llm_chain.predict(input = message)
|
64 |
return result
|
65 |
|
66 |
with gr.Blocks() as demo:
|
67 |
+
llm_chain = chain()
|
68 |
#chatbot_component = gr.Chatbot(height=300, label = "history")
|
69 |
#textbox_component = gr.Textbox(placeholder="Can I help you to book a hotel?", container=False, label = "input", scale=7)
|
70 |
|