rrg92 commited on
Commit
4f5cccc
·
1 Parent(s): 669c03e

removed dataframe output and hide to be used as tool in huggingchat

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -329,7 +329,7 @@ def ChatFunc(message, history, LangMode, ChooseLang):
329
  finally:
330
  yield m.done()
331
 
332
- def SearchFiles(message, JsonOnly = False):
333
 
334
  Question = message;
335
 
@@ -363,13 +363,10 @@ def SearchFiles(message, JsonOnly = False):
363
 
364
  RankedScripts = sorted(FoundScripts, key=lambda item: float(item['rank']), reverse=True)
365
 
366
- result = pd.DataFrame(ScriptTable)
367
- jsonresult = None;
368
- if JsonOnly:
369
- result = None;
370
- jsonresult = json.dumps(RankedScripts)
371
 
372
- return result,jsonresult;
373
 
374
  resultTable = gr.Dataframe(datatype = ['html','number','number'], interactive = False, show_search = "search");
375
  TextResults = gr.Textbox()
@@ -408,12 +405,12 @@ with gr.Blocks(fill_height=True) as demo:
408
 
409
 
410
  with gr.Tab("Rank"):
411
- txtSearchTable = gr.Textbox(label="Search script files",info="Description of what you want")
412
  AsJson = gr.Checkbox(visible = False)
413
  resultTable.render();
414
 
415
 
416
- txtSearchTable.submit(SearchFiles, [txtSearchTable,AsJson],[resultTable,TextResults])
417
 
418
  with gr.Tab("Help"):
419
  gr.Markdown("""
 
329
  finally:
330
  yield m.done()
331
 
332
+ def SearchFiles(message):
333
 
334
  Question = message;
335
 
 
363
 
364
  RankedScripts = sorted(FoundScripts, key=lambda item: float(item['rank']), reverse=True)
365
 
366
+ #result = pd.DataFrame(ScriptTable)
367
+ jsonresult = json.dumps(RankedScripts)
 
 
 
368
 
369
+ return jsonresult;
370
 
371
  resultTable = gr.Dataframe(datatype = ['html','number','number'], interactive = False, show_search = "search");
372
  TextResults = gr.Textbox()
 
405
 
406
 
407
  with gr.Tab("Rank"):
408
+ txtSearchTable = gr.Textbox(label="Search script files",info="Description of what you want", visible = False)
409
  AsJson = gr.Checkbox(visible = False)
410
  resultTable.render();
411
 
412
 
413
+ txtSearchTable.submit(SearchFiles, [txtSearchTable],[TextResults])
414
 
415
  with gr.Tab("Help"):
416
  gr.Markdown("""