whisper / app.py
Pinatpong's picture
Create app.py
6adb940 verified
raw
history blame contribute delete
715 Bytes
import gradio as gr
from transformers import pipeline
# ดึงโมเดลรุ่น Tiny ที่คุณ Duplicate มาไว้ในบัญชีตัวเอง
pipe = pipeline("automatic-speech-recognition", model="Pinatpong/whisper-tiny")
def transcribe(audio):
if audio is None:
return ""
# ถอดความเสียงเป็นข้อความ
result = pipe(audio)
return result["text"]
# สร้างหน้าต่างรับเสียงแบบง่ายๆ
iface = gr.Interface(
fn=transcribe,
inputs=gr.Audio(type="filepath"),
outputs="text",
title="Megatron Voice Assistant (Whisper Tiny)"
)
iface.launch()