Spaces:
Sleeping
Sleeping
Tolulope Ogunremi
commited on
Commit
·
a8f4e47
1
Parent(s):
d73c68d
fixing tab deletion
Browse files
app.py
CHANGED
|
@@ -111,8 +111,6 @@ def get_top_level_dirs(root):
|
|
| 111 |
def load_analyzer_for_subdir(subdir_path):
|
| 112 |
return MultiModelAnalyzer(str(subdir_path))
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
def create_integrated_gradio_interface(analyzer: MultiModelAnalyzer):
|
| 117 |
"""
|
| 118 |
Create comprehensive Gradio interface with model comparison.
|
|
@@ -132,8 +130,9 @@ def create_integrated_gradio_interface(analyzer: MultiModelAnalyzer):
|
|
| 132 |
|
| 133 |
model_names = analyzer.get_model_names()
|
| 134 |
|
| 135 |
-
with gr.
|
| 136 |
-
|
|
|
|
| 137 |
# gr.Markdown("Compare HuBERT models and analyze discrete representations")
|
| 138 |
|
| 139 |
with gr.Tabs():
|
|
@@ -158,10 +157,10 @@ def create_integrated_gradio_interface(analyzer: MultiModelAnalyzer):
|
|
| 158 |
)
|
| 159 |
|
| 160 |
# Initialize
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
)
|
| 165 |
|
| 166 |
# Tab 2: Single Model Analysis
|
| 167 |
"""
|
|
@@ -1019,6 +1018,31 @@ def create_integrated_gradio_interface(analyzer: MultiModelAnalyzer):
|
|
| 1019 |
|
| 1020 |
return demo
|
| 1021 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1022 |
if __name__ == "__main__":
|
| 1023 |
# # Create analyzer
|
| 1024 |
# analyzer = MultiModelAnalyzer(OUTPUT_DIR)
|
|
|
|
| 111 |
def load_analyzer_for_subdir(subdir_path):
|
| 112 |
return MultiModelAnalyzer(str(subdir_path))
|
| 113 |
|
|
|
|
|
|
|
| 114 |
def create_integrated_gradio_interface(analyzer: MultiModelAnalyzer):
|
| 115 |
"""
|
| 116 |
Create comprehensive Gradio interface with model comparison.
|
|
|
|
| 130 |
|
| 131 |
model_names = analyzer.get_model_names()
|
| 132 |
|
| 133 |
+
with gr.Column() as demo:
|
| 134 |
+
|
| 135 |
+
gr.Markdown("Discrete Token Phoneme Analysis")
|
| 136 |
# gr.Markdown("Compare HuBERT models and analyze discrete representations")
|
| 137 |
|
| 138 |
with gr.Tabs():
|
|
|
|
| 157 |
)
|
| 158 |
|
| 159 |
# Initialize
|
| 160 |
+
# refresh_comparison_btn.click(
|
| 161 |
+
# fn=update_comparison,
|
| 162 |
+
# outputs=[comparison_plot, metrics_table]
|
| 163 |
+
# )
|
| 164 |
|
| 165 |
# Tab 2: Single Model Analysis
|
| 166 |
"""
|
|
|
|
| 1018 |
|
| 1019 |
return demo
|
| 1020 |
|
| 1021 |
+
|
| 1022 |
+
def create_root_interface(output_dir):
|
| 1023 |
+
subdirs = get_top_level_dirs(output_dir)
|
| 1024 |
+
|
| 1025 |
+
# Load config
|
| 1026 |
+
try:
|
| 1027 |
+
with open("config.json") as f:
|
| 1028 |
+
config = json.load(f)
|
| 1029 |
+
selected = config.get("selected_dirs", [])
|
| 1030 |
+
if selected:
|
| 1031 |
+
subdirs = [d for d in subdirs if d.name in selected]
|
| 1032 |
+
except FileNotFoundError:
|
| 1033 |
+
pass # Load all if no config
|
| 1034 |
+
|
| 1035 |
+
with gr.Blocks() as demo:
|
| 1036 |
+
gr.Markdown("## Discrete Token Phoneme Analysis")
|
| 1037 |
+
|
| 1038 |
+
with gr.Tabs():
|
| 1039 |
+
for subdir in subdirs:
|
| 1040 |
+
with gr.Tab(subdir.name):
|
| 1041 |
+
analyzer = load_analyzer_for_subdir(subdir)
|
| 1042 |
+
create_integrated_gradio_interface(analyzer)
|
| 1043 |
+
|
| 1044 |
+
return demo
|
| 1045 |
+
|
| 1046 |
if __name__ == "__main__":
|
| 1047 |
# # Create analyzer
|
| 1048 |
# analyzer = MultiModelAnalyzer(OUTPUT_DIR)
|