stcoats commited on
Commit
1c7365b
·
1 Parent(s): e85bb51

Add application file

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -32,19 +32,19 @@ except Exception as e:
32
  st.stop()
33
 
34
  # Search
35
- query = st.text_input("Search text or speaker", "")
36
  query = query.strip().lower()
37
 
38
  if query:
39
  sql = """
40
- SELECT speaker, text, audio
41
  FROM data
42
- WHERE LOWER(CAST(speaker AS VARCHAR)) LIKE ? OR LOWER(CAST(text AS VARCHAR)) LIKE ?
43
  LIMIT 100
44
  """
45
- df = con.execute(sql, [f"%{query}%", f"%{query}%"]).df()
46
  else:
47
- df = con.execute("SELECT speaker, text, audio FROM data LIMIT 100").df()
48
 
49
  st.markdown(f"### Showing {len(df)} results")
50
 
@@ -53,9 +53,14 @@ if len(df) == 0:
53
 
54
  # Show table with inline audio players
55
  for i, row in df.iterrows():
56
- col1, col2, col3 = st.columns([2, 5, 3])
57
- col1.markdown(f"**{row['speaker']}**")
58
- col2.markdown(row['text'])
 
 
 
 
 
59
 
60
  audio_data = row["audio"]
61
  try:
 
32
  st.stop()
33
 
34
  # Search
35
+ query = st.text_input("Search text (case-insensitive)", "")
36
  query = query.strip().lower()
37
 
38
  if query:
39
  sql = """
40
+ SELECT channel, file, speaker, start_time, end_time, text, pos_tags, audio
41
  FROM data
42
+ WHERE LOWER(text) LIKE ?
43
  LIMIT 100
44
  """
45
+ df = con.execute(sql, [f"%{query}%"]).df()
46
  else:
47
+ df = con.execute("SELECT channel, file, speaker, start_time, end_time, text, pos_tags, audio FROM data LIMIT 100").df()
48
 
49
  st.markdown(f"### Showing {len(df)} results")
50
 
 
53
 
54
  # Show table with inline audio players
55
  for i, row in df.iterrows():
56
+ col1, col2, col3 = st.columns([2, 6, 2])
57
+ col1.markdown(f"**Channel:** {row['channel']} ")
58
+ col1.markdown(f"**File:** {row['file']} ")
59
+ col1.markdown(f"**Speaker:** {row['speaker']} ")
60
+ col1.markdown(f"**Start:** {row['start_time']} ")
61
+ col1.markdown(f"**End:** {row['end_time']} ")
62
+ col2.markdown(f"**Text:** {row['text']}")
63
+ col2.markdown(f"**POS tags:** {row['pos_tags']}")
64
 
65
  audio_data = row["audio"]
66
  try: