Bofandra commited on
Commit
4313a99
1 Parent(s): cad36dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -66,7 +66,7 @@ def respond(
66
  messages.append({"role": "user", "content":user })
67
  messages.append({"role": "assistant", "content": assistant})
68
  except:
69
- print("An exception occurred")
70
 
71
  #adding more references
72
  df = pd.read_csv("moslem-bot-reference.csv", sep='|')
@@ -84,9 +84,13 @@ def respond(
84
  #latest user question
85
  from googletrans import Translator
86
  translator = Translator()
87
- message_language = translator.detect(message).lang
88
- print(message_language)
89
- en_message = translator.translate(message).text
 
 
 
 
90
  messages.append({"role": "user", "content": en_message})
91
  #print(messages)
92
 
 
66
  messages.append({"role": "user", "content":user })
67
  messages.append({"role": "assistant", "content": assistant})
68
  except:
69
+ print("adding fatwa references exception occurred")
70
 
71
  #adding more references
72
  df = pd.read_csv("moslem-bot-reference.csv", sep='|')
 
84
  #latest user question
85
  from googletrans import Translator
86
  translator = Translator()
87
+ en_message = ""
88
+ try:
89
+ message_language = translator.detect(message).lang
90
+ print(message_language)
91
+ en_message = translator.translate(message).text
92
+ except:
93
+ print("en_message exception occurred")
94
  messages.append({"role": "user", "content": en_message})
95
  #print(messages)
96