Rulga commited on
Commit
6b5c2b1
·
1 Parent(s): c44066b

Refactor app.py: Remove debug imports and enhance table styling in Gradio interface

Browse files
Files changed (1) hide show
  1. app.py +7 -16
app.py CHANGED
@@ -12,20 +12,6 @@ import gradio as gr
12
  import pandas as pd # Add this import
13
 
14
 
15
- # Debug imports
16
- import pkg_resources
17
- print("Installed packages:")
18
- for pkg in pkg_resources.working_set:
19
- print(pkg.project_name, pkg.version)
20
-
21
- try:
22
- import huggingface_hub
23
- print("huggingface_hub version:", huggingface_hub.__version__)
24
- print("Available modules:", dir(huggingface_hub))
25
- except ImportError:
26
- print("huggingface_hub is not installed")
27
-
28
-
29
  from huggingface_hub import HfApi, InferenceClient
30
  from langdetect import detect, LangDetectException
31
  import langdetect
@@ -876,7 +862,12 @@ def initialize_chat_evaluator():
876
  selected_model, saved_system_prompt = initialize_app()
877
 
878
  # Create interface
879
- with gr.Blocks() as demo:
 
 
 
 
 
880
  # Define clear_conversation function within the block for component access
881
  def clear_conversation():
882
  """Clear conversation and save history before clearing"""
@@ -1146,7 +1137,7 @@ with gr.Blocks() as demo:
1146
  pd.DataFrame(columns=["Conversation ID", "Question", "Timestamp", "Evaluated"]),
1147
  interactive=True,
1148
  wrap=True,
1149
- height=400 # Added explicit height
1150
  )
1151
 
1152
  # Conversation selection section
 
12
  import pandas as pd # Add this import
13
 
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  from huggingface_hub import HfApi, InferenceClient
16
  from langdetect import detect, LangDetectException
17
  import langdetect
 
862
  selected_model, saved_system_prompt = initialize_app()
863
 
864
  # Create interface
865
+ with gr.Blocks(css="""
866
+ .table-container {
867
+ max-height: 400px;
868
+ overflow-y: auto;
869
+ }
870
+ """) as demo:
871
  # Define clear_conversation function within the block for component access
872
  def clear_conversation():
873
  """Clear conversation and save history before clearing"""
 
1137
  pd.DataFrame(columns=["Conversation ID", "Question", "Timestamp", "Evaluated"]),
1138
  interactive=True,
1139
  wrap=True,
1140
+ elem_classes="table-container"
1141
  )
1142
 
1143
  # Conversation selection section