tree3po commited on
Commit
5137eab
·
verified ·
1 Parent(s): d2ff03d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -5
app.py CHANGED
@@ -22,7 +22,14 @@ from prompts import (
22
  )
23
  api=HfApi()
24
 
25
-
 
 
 
 
 
 
 
26
 
27
  client = InferenceClient(
28
  "mistralai/Mixtral-8x7B-Instruct-v0.1"
@@ -257,7 +264,7 @@ def find_all(purpose,task,history, url, result):
257
  if c > MAX_HISTORY:
258
  print("compressing...")
259
  rawp = compress_data(c,purpose,task,out,result)
260
- result += rawp
261
  else:
262
  rawp = out
263
 
@@ -366,14 +373,21 @@ examples =[
366
  "Teach me to fly a helicopter"
367
  ]
368
 
369
-
370
- gr.ChatInterface(
371
  fn=run,
372
  chatbot=gr.Chatbot(show_label=False, show_share_button=True, show_copy_button=True, layout="panel", height="500px"),
373
  title="<center>Mixtral 46.7B Powered <br>Financial Demo<br>This demo is not a Financial Advisor</center>",
374
  examples=examples,
375
  concurrency_limit=20,
376
- ).launch()
 
 
 
 
 
 
 
 
377
  '''
378
  with gr.Blocks() as app:
379
  with gr.Row():
 
22
  )
23
  api=HfApi()
24
 
25
+ get_window_url_params = """
26
+ function(text_input, url_params) {
27
+ console.log(text_input, url_params);
28
+ const params = new URLSearchParams(window.location.search);
29
+ url_params = Object.fromEntries(params);
30
+ return [text_input, url_params];
31
+ }
32
+ """
33
 
34
  client = InferenceClient(
35
  "mistralai/Mixtral-8x7B-Instruct-v0.1"
 
264
  if c > MAX_HISTORY:
265
  print("compressing...")
266
  rawp = compress_data(c,purpose,task,out,result)
267
+ #result += rawp
268
  else:
269
  rawp = out
270
 
 
373
  "Teach me to fly a helicopter"
374
  ]
375
 
376
+ app=gr.ChatInterface(
 
377
  fn=run,
378
  chatbot=gr.Chatbot(show_label=False, show_share_button=True, show_copy_button=True, layout="panel", height="500px"),
379
  title="<center>Mixtral 46.7B Powered <br>Financial Demo<br>This demo is not a Financial Advisor</center>",
380
  examples=examples,
381
  concurrency_limit=20,
382
+ )
383
+
384
+ text_input=gr.Textbox()
385
+ html_game=gr.Textbox()
386
+ url_params = gr.JSON({}, visible=True, label="")
387
+ app.load(predict,[text_input,url_params],[text_input,html_game], _js=get_window_url_params)
388
+
389
+
390
+ app.launch()
391
  '''
392
  with gr.Blocks() as app:
393
  with gr.Row():