SVashishta1 commited on
Commit
7504c5e
·
1 Parent(s): 1659d49

Cleanup: Comment out Settings tab and test visualization functions

Browse files
Files changed (1) hide show
  1. app.py +45 -92
app.py CHANGED
@@ -464,54 +464,6 @@ def clear_context():
464
  except Exception as e:
465
  return [[f"Error clearing context: {str(e)}", None]]
466
 
467
-
468
-
469
-
470
-
471
- def create_test_visualization():
472
- """Create a test visualization to verify plotting works"""
473
- try:
474
- # Create sample data
475
- data = pd.DataFrame({
476
- 'Month': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
477
- 'Value': [10, 15, 13, 17, 20, 25]
478
- })
479
-
480
- # Create a simple bar chart
481
- fig = px.bar(data, x='Month', y='Value', title='Test Visualization')
482
-
483
- # Configure the figure
484
- fig.update_layout(
485
- autosize=True,
486
- width=800,
487
- height=500
488
- )
489
-
490
- return fig
491
- except Exception as e:
492
- print(f"Error creating test visualization: {str(e)}")
493
- return None
494
-
495
- def create_test_html_visualization():
496
- """Create a test HTML visualization to verify plotting works"""
497
- try:
498
- # Create sample data
499
- data = pd.DataFrame({
500
- 'Month': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
501
- 'Value': [10, 15, 13, 17, 20, 25]
502
- })
503
-
504
- # Create a simple bar chart
505
- fig = px.bar(data, x='Month', y='Value', title='Test Visualization')
506
-
507
- # Convert to HTML
508
- html = pio.to_html(fig, full_html=False)
509
-
510
- return html
511
- except Exception as e:
512
- print(f"Error creating test HTML visualization: {str(e)}")
513
- return None
514
-
515
  def flush_databases():
516
  """Flush ChromaDB and SQLite databases"""
517
  global document_assistant
@@ -975,50 +927,51 @@ with gr.Blocks(title="LLM Powered Database Chatbot") as demo:
975
  outputs=[docs_output]
976
  )
977
 
978
- with gr.Tab("Settings"):
979
- with gr.Row():
980
- gr.Markdown("## Database Management")
981
- flush_db_btn = gr.Button("🗑️ Flush All Databases", variant="stop", scale=1)
982
-
983
- flush_result = gr.Textbox(label="Flush Result")
984
-
985
- flush_db_btn.click(
986
- flush_databases,
987
- inputs=[],
988
- outputs=[flush_result]
989
- )
990
-
991
- gr.Markdown("## System Settings")
992
- api_key = gr.Textbox(
993
- label="Groq API Key",
994
- placeholder="Enter your Groq API key",
995
- type="password",
996
- value=os.getenv("GROQ_API_KEY", "")
997
- )
998
- save_btn = gr.Button("Save Settings")
999
-
1000
- def save_settings(key):
1001
- try:
1002
- os.environ["GROQ_API_KEY"] = key
1003
- return "Settings saved!"
1004
- except Exception as e:
1005
- return f"Error saving settings: {str(e)}"
1006
-
1007
- save_btn.click(
1008
- save_settings,
1009
- inputs=[api_key],
1010
- outputs=[gr.Textbox(label="Status")]
1011
- )
1012
-
1013
- gr.Markdown("## Debugging")
1014
- test_viz_btn = gr.Button("Test Visualization")
1015
- test_viz_output = gr.HTML(label="Test Visualization")
1016
-
1017
- test_viz_btn.click(
1018
- create_test_html_visualization,
1019
- inputs=[],
1020
- outputs=[test_viz_output]
1021
- )
 
1022
 
1023
  # Launch the app
1024
  if __name__ == "__main__":
 
464
  except Exception as e:
465
  return [[f"Error clearing context: {str(e)}", None]]
466
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  def flush_databases():
468
  """Flush ChromaDB and SQLite databases"""
469
  global document_assistant
 
927
  outputs=[docs_output]
928
  )
929
 
930
+ # Settings tab commented out as it's not currently used
931
+ # with gr.Tab("Settings"):
932
+ # with gr.Row():
933
+ # gr.Markdown("## Database Management")
934
+ # flush_db_btn = gr.Button("🗑️ Flush All Databases", variant="stop", scale=1)
935
+ #
936
+ # flush_result = gr.Textbox(label="Flush Result")
937
+ #
938
+ # flush_db_btn.click(
939
+ # flush_databases,
940
+ # inputs=[],
941
+ # outputs=[flush_result]
942
+ # )
943
+ #
944
+ # gr.Markdown("## System Settings")
945
+ # api_key = gr.Textbox(
946
+ # label="Groq API Key",
947
+ # placeholder="Enter your Groq API key",
948
+ # type="password",
949
+ # value=os.getenv("GROQ_API_KEY", "")
950
+ # )
951
+ # save_btn = gr.Button("Save Settings")
952
+ #
953
+ # def save_settings(key):
954
+ # try:
955
+ # os.environ["GROQ_API_KEY"] = key
956
+ # return "Settings saved!"
957
+ # except Exception as e:
958
+ # return f"Error saving settings: {str(e)}"
959
+ #
960
+ # save_btn.click(
961
+ # save_settings,
962
+ # inputs=[api_key],
963
+ # outputs=[gr.Textbox(label="Status")]
964
+ # )
965
+ #
966
+ # gr.Markdown("## Debugging")
967
+ # test_viz_btn = gr.Button("Test Visualization")
968
+ # test_viz_output = gr.HTML(label="Test Visualization")
969
+ #
970
+ # test_viz_btn.click(
971
+ # create_test_html_visualization,
972
+ # inputs=[],
973
+ # outputs=[test_viz_output]
974
+ # )
975
 
976
  # Launch the app
977
  if __name__ == "__main__":