Spaces:
Running on Zero
Running on Zero
| # app.py – FIXED – notar Secrets token (ekki harðkóðað) | |
| import os | |
| import gradio as gr | |
| from transformers import pipeline | |
| # Módel nafnið (þitt private) | |
| MODEL_NAME = "palli23/whisper-small-sam_spjall" | |
| # Nota Secrets token – aldrei sýnilegt | |
| pipe = pipeline( | |
| "automatic-speech-recognition", | |
| model=MODEL_NAME, | |
| device=0, | |
| token=os.getenv("HF_TOKEN") # ← þetta notar Secrets token | |
| ) | |
| def transcribe(audio): | |
| if not audio: | |
| return "Hladdu upp hljóð" | |
| result = pipe(audio) | |
| return result["text"] | |
| with gr.Blocks(theme=gr.themes.Soft()) as demo: | |
| gr.Markdown("# Íslenskt ASR – Beta") | |
| gr.Markdown("Whisper-small · ~4–5 % WER") | |
| audio = gr.Audio(type="filepath") | |
| btn = gr.Button("Transcribe") | |
| out = gr.Textbox(lines=20) | |
| btn.click(transcribe, audio, out) | |
| demo.launch(auth=("beta", "beta2025")) |