Terry Zhuo commited on
Commit
e68b14d
·
1 Parent(s): fefc0c6
Files changed (2) hide show
  1. __pycache__/log_reader.cpython-311.pyc +0 -0
  2. app.py +20 -17
__pycache__/log_reader.cpython-311.pyc ADDED
Binary file (6.99 kB). View file
 
app.py CHANGED
@@ -90,18 +90,15 @@ def search_battle_anony(date_str: str, search_query: str) -> list[list]:
90
  return results
91
 
92
  def create_ui():
93
- def process_search(date, query):
94
  if not query.strip():
95
  return []
96
 
97
- # Convert timestamp to datetime object
98
- date_obj = datetime.fromtimestamp(date)
99
- # Convert date to required format (YYYY_MM_DD)
100
- date_str = date_obj.strftime("%Y_%m_%d")
101
  results = search_battle_anony(date_str, query)
102
 
103
  if not results:
104
- # Return empty list with correct structure for DataFrame
105
  return []
106
  return results
107
 
@@ -110,16 +107,22 @@ def create_ui():
110
  gr.Markdown("Search for specific content in battle_anony conversations by date and view IP addresses with validation status.")
111
 
112
  with gr.Row():
113
- date_input = gr.DateTime(
114
- label="Select Date",
115
- include_time=False,
116
- )
117
-
118
- query_input = gr.Textbox(
119
- label="Search Query",
120
- placeholder="Enter text to search for in conversations...",
121
- lines=1
122
- )
 
 
 
 
 
 
123
 
124
  with gr.Row():
125
  search_button = gr.Button("Search")
@@ -134,7 +137,7 @@ def create_ui():
134
 
135
  search_button.click(
136
  fn=process_search,
137
- inputs=[date_input, query_input],
138
  outputs=[table_output]
139
  )
140
 
 
90
  return results
91
 
92
  def create_ui():
93
+ def process_search(month, day, query):
94
  if not query.strip():
95
  return []
96
 
97
+ # Create date string in YYYY_MM_DD format
98
+ date_str = f"2025_{month}_{day}"
 
 
99
  results = search_battle_anony(date_str, query)
100
 
101
  if not results:
 
102
  return []
103
  return results
104
 
 
107
  gr.Markdown("Search for specific content in battle_anony conversations by date and view IP addresses with validation status.")
108
 
109
  with gr.Row():
110
+ with gr.Column():
111
+ month_input = gr.Dropdown(
112
+ choices=[f"{i:02d}" for i in range(1, 13)],
113
+ label="Month",
114
+ value="01"
115
+ )
116
+ day_input = gr.Dropdown(
117
+ choices=[f"{i:02d}" for i in range(1, 32)],
118
+ label="Day",
119
+ value="01"
120
+ )
121
+ query_input = gr.Textbox(
122
+ label="Search Query",
123
+ placeholder="Enter text to search for in conversations...",
124
+ lines=1
125
+ )
126
 
127
  with gr.Row():
128
  search_button = gr.Button("Search")
 
137
 
138
  search_button.click(
139
  fn=process_search,
140
+ inputs=[month_input, day_input, query_input],
141
  outputs=[table_output]
142
  )
143