Spaces:
Sleeping
Sleeping
williamagyapong
commited on
Update main.py
Browse files
main.py
CHANGED
@@ -170,12 +170,18 @@ def hook():
|
|
170 |
transcript = transcriber.transcribe(audio_filename)
|
171 |
print(audio_filename)
|
172 |
print(transcript.text)
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
else:
|
181 |
messenger.send_message(message="Please send me text or audio messages", recipient_id=mobile)
|
|
|
170 |
transcript = transcriber.transcribe(audio_filename)
|
171 |
print(audio_filename)
|
172 |
print(transcript.text)
|
173 |
+
transcribed_message = transcript.text
|
174 |
+
# Handle greetings
|
175 |
+
if transcribed_message.lower() in ("hi", "hello", "help", "how are you"):
|
176 |
+
response = "Hi there! My name is SmartLedger. How can I help you today?"
|
177 |
+
|
178 |
+
messenger.send_message(message=f"{response}", recipient_id=mobile)
|
179 |
+
elif:
|
180 |
+
# logging.info(f"\nAudio: {audio}\n")
|
181 |
+
messenger_reply_button(mobile, transcribed_message)
|
182 |
+
firestore_msg1, parsed_trans_data1, response1 = process_user_msg(transcribed_message, mobile)
|
183 |
+
messenger.send_message(message=f"Raw Response: {response1}, \n \n Parsed Response: {parsed_trans_data1}, \n \n Final Response: {firestore_msg1}", recipient_id=mobile)
|
184 |
+
|
185 |
|
186 |
else:
|
187 |
messenger.send_message(message="Please send me text or audio messages", recipient_id=mobile)
|