Spaces:
Runtime error
Runtime error
| """Minimal test app — no imports from the main app.""" | |
| import os | |
| os.environ["SOUNDBROKEN_MOCK"] = "1" | |
| import gradio as gr | |
| def diagnose(audio, appliance): | |
| if audio is None: | |
| return "<div class='verdict'>Upload audio first.</div>" | |
| return f"<div class='verdict' style='border-left:8px solid #FB8C00'><div class='fault'>Diagnosis for {appliance}</div><div class='label'>Test successful!</div></div>" | |
| with gr.Blocks(title="Does It Sound Broken?") as demo: | |
| gr.Markdown("# Does It Sound Broken?") | |
| with gr.Tab("Diagnose"): | |
| audio = gr.Audio(sources=["microphone","upload"], type="filepath", label="Record audio") | |
| dd = gr.Dropdown(choices=["Washing machine","Electric fan","Car engine"], value="Washing machine") | |
| btn = gr.Button("Diagnose", variant="primary") | |
| out = gr.HTML() | |
| btn.click(diagnose, [audio, dd], out) | |
| if __name__ == "__main__": | |
| demo.launch(server_port=8090, server_name="127.0.0.1", show_error=True) | |