Mahbodez commited on
Commit
721ffa0
·
1 Parent(s): 9564150

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -24
app.py CHANGED
@@ -27,28 +27,17 @@ if report_interface.prime_model() is False:
27
  else:
28
  print("Model priming successful.")
29
 
30
- running = True
31
-
32
 
33
  def check_report(report):
34
- if running:
35
- results = report_interface.process_input(report)
36
- if results == "quit":
37
- quit_fn()
38
- elif results == "help":
39
- return report_interface.help_message
40
- elif results == "exception":
41
- return "An exception occurred. Please try again."
42
- else:
43
- return results
44
  else:
45
- return "Model has been stopped."
46
-
47
-
48
- def quit_fn():
49
- global running
50
- running = False
51
- return "Model has been stopped."
52
 
53
 
54
  with gr.Blocks(theme="Taithrah/Minimal") as demo:
@@ -62,13 +51,10 @@ with gr.Blocks(theme="Taithrah/Minimal") as demo:
62
  clear_btn = gr.ClearButton(
63
  value="Clear Messages",
64
  )
65
- quit_btn = gr.Button(
66
- value="Quit",
67
- )
68
  results_textbox = gr.TextArea(label="Results", lines=20, max_lines=50)
69
  clear_btn.add([results_textbox, report_textbox])
70
-
71
  check_btn.click(fn=check_report, inputs=[report_textbox], outputs=[results_textbox])
72
- quit_btn.click(fn=quit_fn, outputs=[results_textbox])
73
 
74
  demo.launch(auth=(user, passwd))
 
27
  else:
28
  print("Model priming successful.")
29
 
 
 
30
 
31
  def check_report(report):
32
+ results = report_interface.process_input(report)
33
+ if results == "quit":
34
+ quit_fn()
35
+ elif results == "help":
36
+ return report_interface.help_message
37
+ elif results == "exception":
38
+ return "An exception occurred. Please try again."
 
 
 
39
  else:
40
+ return results
 
 
 
 
 
 
41
 
42
 
43
  with gr.Blocks(theme="Taithrah/Minimal") as demo:
 
51
  clear_btn = gr.ClearButton(
52
  value="Clear Messages",
53
  )
54
+
 
 
55
  results_textbox = gr.TextArea(label="Results", lines=20, max_lines=50)
56
  clear_btn.add([results_textbox, report_textbox])
57
+
58
  check_btn.click(fn=check_report, inputs=[report_textbox], outputs=[results_textbox])
 
59
 
60
  demo.launch(auth=(user, passwd))