Upload folder using huggingface_hub
Browse files- README.md +1 -1
- app.py +3 -4
- requirements.txt +1 -1
README.md
CHANGED
|
@@ -3,7 +3,7 @@ title: AnomalyMachine-50K Demo
|
|
| 3 |
colorFrom: red
|
| 4 |
colorTo: gray
|
| 5 |
sdk: gradio
|
| 6 |
-
sdk_version: 4.
|
| 7 |
python_version: "3.10"
|
| 8 |
app_file: app.py
|
| 9 |
pinned: true
|
|
|
|
| 3 |
colorFrom: red
|
| 4 |
colorTo: gray
|
| 5 |
sdk: gradio
|
| 6 |
+
sdk_version: 4.35.0
|
| 7 |
python_version: "3.10"
|
| 8 |
app_file: app.py
|
| 9 |
pinned: true
|
app.py
CHANGED
|
@@ -55,7 +55,7 @@ def create_spectrogram(audio_path, title="Spectrogram"):
|
|
| 55 |
def predict_anomaly(audio_file, machine_type):
|
| 56 |
"""Predict anomaly in audio."""
|
| 57 |
if audio_file is None:
|
| 58 |
-
return "Please upload an audio file.",
|
| 59 |
|
| 60 |
import random
|
| 61 |
random.seed(hash(str(audio_file)) % 1000)
|
|
@@ -81,7 +81,7 @@ def predict_anomaly(audio_file, machine_type):
|
|
| 81 |
if ref_files:
|
| 82 |
ref_spec = create_spectrogram(str(ref_files[0]), f"Reference - {machine_type}")
|
| 83 |
|
| 84 |
-
return result,
|
| 85 |
|
| 86 |
|
| 87 |
theme = gr.themes.Monochrome(primary_hue="red", secondary_hue="gray")
|
|
@@ -105,7 +105,6 @@ with gr.Blocks(theme=theme, title="AnomalyMachine-50K Demo") as app:
|
|
| 105 |
|
| 106 |
with gr.Column():
|
| 107 |
result_html = gr.HTML()
|
| 108 |
-
confidence_bar = gr.Slider(minimum=0, maximum=1, value=0, label="Confidence", interactive=False)
|
| 109 |
|
| 110 |
with gr.Row():
|
| 111 |
input_spec = gr.Image(label="Input Spectrogram")
|
|
@@ -114,7 +113,7 @@ with gr.Blocks(theme=theme, title="AnomalyMachine-50K Demo") as app:
|
|
| 114 |
predict_btn.click(
|
| 115 |
fn=predict_anomaly,
|
| 116 |
inputs=[audio_input, machine_dropdown],
|
| 117 |
-
outputs=[result_html,
|
| 118 |
)
|
| 119 |
|
| 120 |
with gr.Tab("📊 Explore Dataset"):
|
|
|
|
| 55 |
def predict_anomaly(audio_file, machine_type):
|
| 56 |
"""Predict anomaly in audio."""
|
| 57 |
if audio_file is None:
|
| 58 |
+
return "Please upload an audio file.", None, None
|
| 59 |
|
| 60 |
import random
|
| 61 |
random.seed(hash(str(audio_file)) % 1000)
|
|
|
|
| 81 |
if ref_files:
|
| 82 |
ref_spec = create_spectrogram(str(ref_files[0]), f"Reference - {machine_type}")
|
| 83 |
|
| 84 |
+
return result, input_spec, ref_spec
|
| 85 |
|
| 86 |
|
| 87 |
theme = gr.themes.Monochrome(primary_hue="red", secondary_hue="gray")
|
|
|
|
| 105 |
|
| 106 |
with gr.Column():
|
| 107 |
result_html = gr.HTML()
|
|
|
|
| 108 |
|
| 109 |
with gr.Row():
|
| 110 |
input_spec = gr.Image(label="Input Spectrogram")
|
|
|
|
| 113 |
predict_btn.click(
|
| 114 |
fn=predict_anomaly,
|
| 115 |
inputs=[audio_input, machine_dropdown],
|
| 116 |
+
outputs=[result_html, input_spec, ref_spec]
|
| 117 |
)
|
| 118 |
|
| 119 |
with gr.Tab("📊 Explore Dataset"):
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
gradio==4.
|
| 2 |
librosa==0.10.2
|
| 3 |
matplotlib==3.8.2
|
| 4 |
numpy==1.26.4
|
|
|
|
| 1 |
+
gradio==4.35.0
|
| 2 |
librosa==0.10.2
|
| 3 |
matplotlib==3.8.2
|
| 4 |
numpy==1.26.4
|