freddyaboulton HF Staff commited on
Commit
bf18264
·
1 Parent(s): 3a3b17f
Files changed (3) hide show
  1. Karaoke_Huggy.png +0 -0
  2. app.py +14 -12
  3. search.py +2 -3
Karaoke_Huggy.png ADDED
app.py CHANGED
@@ -37,7 +37,9 @@ def audio_search(audio_tuple):
37
  row["audio"] = [
38
  "<audio src=" + orig_row["audio"][0]["src"] + " controls />"
39
  ]
40
- return pd.DataFrame(rows)[["path", "audio", "sentence", "distance"]].sort_values(by="distance", ascending=True)
 
 
41
 
42
 
43
  iface = gr.Interface(
@@ -53,18 +55,18 @@ iface = gr.Interface(
53
  with gr.Blocks() as demo:
54
  gr.HTML(
55
  f"""
56
- <h1 style='text-align: center'>
57
- <img src="/gradio_api/file=logo.svg" alt="Voice Match" style="width: 95px; height: 30px;"> <br> Voice Match
58
- </h1>
59
- """
60
- )
61
  gr.HTML(
62
- f"""
63
- <h2 style='text-align: center'>
64
- Powered by <a href="https://huggingface.co/rimelabs/rimecaster">RimeCaster</a>
65
- </h2>
66
- """
67
- )
68
  gr.Markdown(
69
  f"""
70
  <div style='text-align: center'>
 
37
  row["audio"] = [
38
  "<audio src=" + orig_row["audio"][0]["src"] + " controls />"
39
  ]
40
+ return pd.DataFrame(rows)[["path", "audio", "sentence", "distance"]].sort_values(
41
+ by="distance", ascending=True
42
+ )
43
 
44
 
45
  iface = gr.Interface(
 
55
  with gr.Blocks() as demo:
56
  gr.HTML(
57
  f"""
58
+ <h1 style='text-align: center; display: flex; align-items: center; justify-content: center;'>
59
+ <img src="/gradio_api/file=Karaoke_Huggy.png" alt="Voice Match" style="width: 95px; height: 30px; margin-right: 10px"> Voice Match
60
+ </h1>
61
+ """
62
+ )
63
  gr.HTML(
64
+ """
65
+ <h2 style='text-align: center'>
66
+ Powered by <a href="https://huggingface.co/rimelabs/rimecaster">RimeCaster</a>
67
+ </h2>
68
+ """
69
+ )
70
  gr.Markdown(
71
  f"""
72
  <div style='text-align: center'>
search.py CHANGED
@@ -6,6 +6,7 @@ headers = {"Authorization": f"Bearer {os.getenv('HF_TOKEN')}"}
6
  dataset = "mozilla-foundation/common_voice_17_0"
7
  config = "en"
8
 
 
9
  def _search(paths: list[str]):
10
  if len(paths) == 0:
11
  return []
@@ -13,7 +14,6 @@ def _search(paths: list[str]):
13
  split = "train"
14
  else:
15
  split = "validation"
16
-
17
 
18
  paths_in_clause = ", ".join([f"'{path}'" for path in paths])
19
  where_clause = f'"path" IN ({paths_in_clause})'
@@ -26,6 +26,7 @@ def _search(paths: list[str]):
26
 
27
  return data.get("rows", [])
28
 
 
29
  def search(rows: list[dict]):
30
  file_paths_to_find = [row["path"] for row in rows]
31
  train_paths = []
@@ -41,8 +42,6 @@ def search(rows: list[dict]):
41
 
42
  return train_rows + validation_rows
43
 
44
-
45
-
46
  paths_in_clause = ", ".join([f"'{path}'" for path in file_paths_to_find])
47
  where_clause = f'"path" IN ({paths_in_clause})'
48
 
 
6
  dataset = "mozilla-foundation/common_voice_17_0"
7
  config = "en"
8
 
9
+
10
  def _search(paths: list[str]):
11
  if len(paths) == 0:
12
  return []
 
14
  split = "train"
15
  else:
16
  split = "validation"
 
17
 
18
  paths_in_clause = ", ".join([f"'{path}'" for path in paths])
19
  where_clause = f'"path" IN ({paths_in_clause})'
 
26
 
27
  return data.get("rows", [])
28
 
29
+
30
  def search(rows: list[dict]):
31
  file_paths_to_find = [row["path"] for row in rows]
32
  train_paths = []
 
42
 
43
  return train_rows + validation_rows
44
 
 
 
45
  paths_in_clause = ", ".join([f"'{path}'" for path in file_paths_to_find])
46
  where_clause = f'"path" IN ({paths_in_clause})'
47