namann007 commited on
Commit
a0ec8dd
1 Parent(s): 9b943ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -4
app.py CHANGED
@@ -47,6 +47,21 @@ st.markdown(
47
  flex: 1;
48
  margin-right: 10px;
49
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  </style>
51
  """,
52
  unsafe_allow_html=True
@@ -70,10 +85,8 @@ def chef_bot(question, chat_history):
70
  f"If the customer has rated the restaurant on the website, offer a coupon of 20% discount. "
71
  f"If it is a weekend, offer a free drink to the customer. "
72
  f"If the customer is visiting on weekends between 3 to 6 p.m., offer a free snack item."
73
- f"Highlight the above 4 offers in bullet points and bold and small, cute emojis"
74
  f'For the first message of customer you always have to begin with "Welcome to the chef story. We hope to bring smile on your cute faces by our timely service.".'
75
-
76
-
77
  )
78
 
79
  llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])
@@ -91,6 +104,9 @@ def handle_chat():
91
  st.session_state.chat_history.append(("Chef Story", bot_response))
92
  st.session_state['user_input'] = ""
93
 
 
 
 
94
  # Welcome message
95
  st.markdown("Welcome to The Chef Story where culinary excellence meets folklore magic. We are thrilled to have you here. Hope you will enjoy your meal and have an amazing day.")
96
 
@@ -101,5 +117,8 @@ if st.session_state.chat_history:
101
  st.markdown(f'<div class="chat-box {class_name}">{message}</div>', unsafe_allow_html=True)
102
 
103
  # Input field for user message
104
- st.text_input("How may I assist you today?", key="user_input", on_change=handle_chat, placeholder="Ask me anything...")
105
 
 
 
 
 
47
  flex: 1;
48
  margin-right: 10px;
49
  }
50
+ .button {
51
+ display: inline-block;
52
+ padding: 10px 20px;
53
+ background-color: #007BFF;
54
+ color: #fff;
55
+ border: none;
56
+ border-radius: 5px;
57
+ cursor: pointer;
58
+ font-size: 16px;
59
+ margin: 10px;
60
+ text-align: center;
61
+ }
62
+ .button:hover {
63
+ background-color: #0056b3;
64
+ }
65
  </style>
66
  """,
67
  unsafe_allow_html=True
 
85
  f"If the customer has rated the restaurant on the website, offer a coupon of 20% discount. "
86
  f"If it is a weekend, offer a free drink to the customer. "
87
  f"If the customer is visiting on weekends between 3 to 6 p.m., offer a free snack item."
88
+ f"Highlight the above 4 offers in bullet points and bold and small, cute emojis."
89
  f'For the first message of customer you always have to begin with "Welcome to the chef story. We hope to bring smile on your cute faces by our timely service.".'
 
 
90
  )
91
 
92
  llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])
 
104
  st.session_state.chat_history.append(("Chef Story", bot_response))
105
  st.session_state['user_input'] = ""
106
 
107
+ def generate_response():
108
+ handle_chat()
109
+
110
  # Welcome message
111
  st.markdown("Welcome to The Chef Story where culinary excellence meets folklore magic. We are thrilled to have you here. Hope you will enjoy your meal and have an amazing day.")
112
 
 
117
  st.markdown(f'<div class="chat-box {class_name}">{message}</div>', unsafe_allow_html=True)
118
 
119
  # Input field for user message
120
+ st.text_input("How may I assist you today?", key="user_input", on_change=generate_response, placeholder="Ask me anything...")
121
 
122
+ # Button for generating response
123
+ if st.button("Generate Response"):
124
+ generate_response()