Logeswaransr commited on
Commit
33c6f10
1 Parent(s): 48bf45d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -16,7 +16,7 @@ tokenizer=T5Tokenizer.from_pretrained("Logeswaransr/T5_MineAI_Prototype")
16
 
17
  pipe=pipeline('text2text-generation', model=model, tokenizer=tokenizer)
18
 
19
-
20
 
21
  greetings=["Hello! My name is MineAI, A specially trained LLM here to assist you on your Mining Related Queries.","How may I help you?"]
22
 
@@ -37,6 +37,10 @@ if st.session_state.messages==[]:
37
  for gr in greetings:
38
  with st.chat_message("assistant"):
39
  st.markdown(gr)
 
 
 
 
40
 
41
  st.session_state.messages.append({
42
  'role':'assistant',
@@ -57,6 +61,10 @@ if prompt:=st.chat_input("Enter your query"):
57
 
58
  with st.chat_message("assistant"):
59
  st.markdown(response)
 
 
 
 
60
 
61
  st.session_state.messages.append({
62
  'role':'assistant',
 
16
 
17
  pipe=pipeline('text2text-generation', model=model, tokenizer=tokenizer)
18
 
19
+ sound_file = BytesIO()
20
 
21
  greetings=["Hello! My name is MineAI, A specially trained LLM here to assist you on your Mining Related Queries.","How may I help you?"]
22
 
 
37
  for gr in greetings:
38
  with st.chat_message("assistant"):
39
  st.markdown(gr)
40
+
41
+ tts=gTTS(gr)
42
+ tts.write_to_fp(sound_file)
43
+ st.audio(sound_file)
44
 
45
  st.session_state.messages.append({
46
  'role':'assistant',
 
61
 
62
  with st.chat_message("assistant"):
63
  st.markdown(response)
64
+
65
+ tts=gTTS(response)
66
+ tts.write_to_fp(sound_file)
67
+ st.audio(sound_file)
68
 
69
  st.session_state.messages.append({
70
  'role':'assistant',