Quyet commited on
Commit
617fa8c
1 Parent(s): c0399e9

fix gradio bug

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import re, time
2
  import matplotlib.pyplot as plt
3
  from threading import Timer
@@ -197,6 +198,10 @@ def chat(message, history):
197
  if __name__ == '__main__':
198
  # euc_100()
199
  # euc_200('I am happy about my academic record.')
 
 
 
 
200
  title = "PsyPlus Empathetic Chatbot"
201
  description = "Gradio demo for product of PsyPlus. Based on rule-based CBT and conversational AI model DialoGPT"
202
  iface = gr.Interface(
@@ -208,4 +213,7 @@ if __name__ == '__main__':
208
  title=title,
209
  description=description,
210
  )
211
- iface.launch(debug=True, server_name="0.0.0.0", server_port=2022, share=True)
 
 
 
 
1
+ import argparse
2
  import re, time
3
  import matplotlib.pyplot as plt
4
  from threading import Timer
 
198
  if __name__ == '__main__':
199
  # euc_100()
200
  # euc_200('I am happy about my academic record.')
201
+ parser = argparse.ArgumentParser()
202
+ parser.add_argument('--run_share_mode', type=int, default=0, help='if test on own server, need to use share mode')
203
+ args = parser.parse_args()
204
+
205
  title = "PsyPlus Empathetic Chatbot"
206
  description = "Gradio demo for product of PsyPlus. Based on rule-based CBT and conversational AI model DialoGPT"
207
  iface = gr.Interface(
 
213
  title=title,
214
  description=description,
215
  )
216
+ if args.run_share_mode == 0:
217
+ iface.launch(debug=True)
218
+ else:
219
+ iface.launch(debug=True, server_name="0.0.0.0", server_port=2022, share=True)