Omnibus commited on
Commit
a7acc0e
·
1 Parent(s): 25ae17f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -28,7 +28,7 @@ def test_fn():
28
  tot_time=datetime.datetime.now()-time
29
  out_box.append({"name":this_obj[i].id, "error":f"Function 1 Error :: {e}", "success":"","time":tot_time})
30
  yield (out_box)
31
- out = generate("what is a cat?", "", "",this_obj[i].id,True)
32
  print (this_obj[i].id +"--"+out)
33
  tot_time=datetime.datetime.now()-time
34
  out_box.append({"name":this_obj[i].id, "error":f"Function 1 Error :: {e}", "success":f"{out}","time":tot_time})
@@ -40,7 +40,7 @@ def test_fn():
40
  yield (out_box)
41
  try:
42
  time = datetime.datetime.now()
43
- out1 = generate("what is a cat?", "", "",this_obj[i].id,False)
44
  print (this_obj[i].id +"--"+out1)
45
  tot_time=datetime.datetime.now()-time
46
  out_box.append({"name":this_obj[i].id, "error":f"Function 1 Error :: {e}", "success":f"{out1}","time":tot_time})
@@ -142,9 +142,12 @@ examples=[["I'm planning a vacation to Japan. Can you suggest a one-week itinera
142
  ["What are some unique features of Rust that make it stand out compared to other systems programming languages like C++?", None, None, None, None, None,],
143
  ]
144
  with gr.Blocks() as app:
145
- button=gr.Button()
 
 
146
  text=gr.JSON()
147
- button.click(test_fn,None,text)
 
148
  app.launch()
149
 
150
  """gr.ChatInterface(
 
28
  tot_time=datetime.datetime.now()-time
29
  out_box.append({"name":this_obj[i].id, "error":f"Function 1 Error :: {e}", "success":"","time":tot_time})
30
  yield (out_box)
31
+ out = generate("what is a cat?",this_obj[i].id,True)
32
  print (this_obj[i].id +"--"+out)
33
  tot_time=datetime.datetime.now()-time
34
  out_box.append({"name":this_obj[i].id, "error":f"Function 1 Error :: {e}", "success":f"{out}","time":tot_time})
 
40
  yield (out_box)
41
  try:
42
  time = datetime.datetime.now()
43
+ out1 = generate("what is a cat?",this_obj[i].id,False)
44
  print (this_obj[i].id +"--"+out1)
45
  tot_time=datetime.datetime.now()-time
46
  out_box.append({"name":this_obj[i].id, "error":f"Function 1 Error :: {e}", "success":f"{out1}","time":tot_time})
 
142
  ["What are some unique features of Rust that make it stand out compared to other systems programming languages like C++?", None, None, None, None, None,],
143
  ]
144
  with gr.Blocks() as app:
145
+ with gr.Row():
146
+ button=gr.Button()
147
+ stop_button=gr.Button("Stop")
148
  text=gr.JSON()
149
+ go=button.click(test_fn,None,text)
150
+ stop_button.click(None,None,None,cancels=[go])
151
  app.launch()
152
 
153
  """gr.ChatInterface(