Omnibus commited on
Commit
3d1aff1
·
verified ·
1 Parent(s): 094ece2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -28
app.py CHANGED
@@ -328,7 +328,7 @@ def run_action(purpose, task, history, action_name, action_input,result):
328
  return "MAIN", None, history, task, result
329
 
330
  def run(purpose,history):
331
- yield "Searching..."
332
  task=None
333
  result=""
334
  #history = ""
@@ -358,16 +358,62 @@ def run(purpose,history):
358
  )
359
 
360
  if not result:
361
- yield "More Searching..."
362
  else:
363
- yield result
364
  if action_name == "COMPLETE":
365
  break
366
- return result
367
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
 
369
 
370
 
 
371
  examples =[
372
  "What is the current weather in Florida?",
373
  "Find breaking news about Texas",
@@ -382,28 +428,5 @@ gr.ChatInterface(
382
  examples=examples,
383
  concurrency_limit=20,
384
  ).launch()
385
-
386
-
387
-
388
  '''
389
- with gr.Blocks() as app:
390
- with gr.Row():
391
- with gr.Column(scale=1):
392
- inp = gr.Textbox()
393
- with gr.Column(scale=2):
394
- q = gr.Textbox(value="p")
395
- with gr.Column(scale=2):
396
- num = gr.Textbox()
397
- with gr.Row():
398
- all_btn = gr.Button("Load")
399
- find_btn = gr.Button("Find")
400
- with gr.Row():
401
- rawp = gr.JSON()
402
- outp = gr.JSON()
403
- outl = gr.Textbox()
404
-
405
- all_btn.click(find_all,[inp,q,num],[rawp])
406
- find_btn.click(find_it,[inp,q,num],[outp,outl])
407
-
408
- app.launch()
409
- '''
 
328
  return "MAIN", None, history, task, result
329
 
330
  def run(purpose,history):
331
+ yield [(purpose,"Searching...")]
332
  task=None
333
  result=""
334
  #history = ""
 
358
  )
359
 
360
  if not result:
361
+ yield [(purpose,"More Searching...")]
362
  else:
363
+ yield [(purpose,result)]
364
  if action_name == "COMPLETE":
365
  break
366
+ return [(purpose,result)]
367
 
368
+ examples =[
369
+ "What is the current weather in Florida?",
370
+ "Find breaking news about Texas",
371
+ "Find the best deals on flippers for scuba diving",
372
+ "Teach me to fly a helicopter"
373
+ ]
374
+
375
+
376
+ with gr.Blocks() as app:
377
+ gr.HTML("""<center><h1>Mixtral 8x7B RPG</h1><h3>Role Playing Game Master</h3>""")
378
+ with gr.Group():
379
+ with gr.Row():
380
+ with gr.Column(scale=3):
381
+ chatbot=gr.Chatbot(show_label=False, show_share_button=True, show_copy_button=True, likeable=True, layout="panel", height="800px")
382
+ with gr.Row():
383
+ with gr.Column(scale=3):
384
+ opt=gr.Dropdown(label="Choices",choices=examples,allow_custom_value=True, value="Start a new game", interactive=True)
385
+ #prompt=gr.Textbox(label = "Prompt", value="Start a new game")
386
+ with gr.Column(scale=2):
387
+ rand = gr.Checkbox(label="Random", value=True)
388
+ seed=gr.Slider(label="Seed", minimum=1, maximum=99999999999, value=rand_val)
389
+ #models_dd=gr.Dropdown(choices=[m for m in return_list],interactive=True)
390
+ with gr.Row():
391
+ button=gr.Button()
392
+ stop_button=gr.Button("Stop")
393
+ clear_btn = gr.Button("Clear")
394
+ with gr.Row():
395
+ tokens = gr.Slider(label="Max new tokens",value=2096,minimum=0,maximum=1048*10,step=64,interactive=False, visible=False,info="The maximum numbers of new tokens")
396
+ with gr.Column(scale=1):
397
+ char_stats=gr.Textbox(value=text_stats)
398
+ json_out=gr.JSON()
399
+ textboxes = []
400
+ if opts:
401
+ textboxes.clear()
402
+ for i in range(len(opts)-1):
403
+ t = gr.Button(f"{opts[i]}")
404
+ textboxes.append(t)
405
+ #text=gr.JSON()
406
+ #inp_query.change(search_models,inp_query,models_dd)
407
+ #test_b=test_btn.click(itt,url,e_box)
408
+ clear_btn.click(clear_fn,None,[opt,chatbot])
409
+ #go=button.click(check_rand,[rand,seed],seed).then(run,[opt,chatbot,tokens,char_stats,seed],[chatbot,char_stats,json_out,opt])
410
+ go=button.click(check_rand,[rand,seed],seed).then(run,[opt,chatbot],[chatbot])
411
+ stop_button.click(None,None,None,cancels=[go])
412
+ app.launch(show_api=False)
413
 
414
 
415
 
416
+ '''
417
  examples =[
418
  "What is the current weather in Florida?",
419
  "Find breaking news about Texas",
 
428
  examples=examples,
429
  concurrency_limit=20,
430
  ).launch()
 
 
 
431
  '''
432
+