Bofandra commited on
Commit
22855ab
1 Parent(s): 4186c91

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -63,8 +63,9 @@ def respond(message,
63
  #print(assistant)
64
  messages.append({"role": "user", "content":user })
65
  messages.append({"role": "assistant", "content": assistant})
66
- except:
67
- print("adding fatwa references exception occurred")
 
68
 
69
  #adding more references
70
  df = pd.read_csv("moslem-bot-reference.csv", sep='|')
@@ -96,8 +97,9 @@ def respond(message,
96
  print(translator.translate(message))
97
  en_message = translator.translate(message).text
98
  messages.append({"role": "user", "content": en_message})
99
- except:
100
  messages.append({"role": "user", "content": message})
 
101
  print("en_message exception occurred")
102
 
103
  #print(messages)
@@ -116,7 +118,8 @@ def respond(message,
116
  response += token
117
  translated_response = translator.translate(response, src='en', dest=message_language).text
118
  yield translated_response
119
- except:
 
120
  yield ""
121
 
122
  demo = gr.Interface(
 
63
  #print(assistant)
64
  messages.append({"role": "user", "content":user })
65
  messages.append({"role": "assistant", "content": assistant})
66
+ except Exception as error:
67
+ print("An error occurred:", error)
68
+ print("adding fatwa references exception occurred")
69
 
70
  #adding more references
71
  df = pd.read_csv("moslem-bot-reference.csv", sep='|')
 
97
  print(translator.translate(message))
98
  en_message = translator.translate(message).text
99
  messages.append({"role": "user", "content": en_message})
100
+ except Exception as error:
101
  messages.append({"role": "user", "content": message})
102
+ print("An error occurred:", error)
103
  print("en_message exception occurred")
104
 
105
  #print(messages)
 
118
  response += token
119
  translated_response = translator.translate(response, src='en', dest=message_language).text
120
  yield translated_response
121
+ except Exception as error:
122
+ print("An error occurred:", error)
123
  yield ""
124
 
125
  demo = gr.Interface(