Spaces:
No application file
No application file
| import telebot | |
| import whisper | |
| import os | |
| TOKEN = "8514932008:AAGX3GyNd-9t8GBEYHm7JYfEZlztxAJvr4A" | |
| bot = telebot.TeleBot(TOKEN) | |
| model = whisper.load_model("medium") | |
| def handle_file(message): | |
| file_info = bot.get_file(message.document.file_id if message.document else message.video.file_id) | |
| downloaded = bot.download_file(file_info.file_path) | |
| file_name = "input_file" | |
| with open(file_name, "wb") as f: | |
| f.write(downloaded) | |
| result = model.transcribe(file_name) | |
| with open("output.srt","w") as f: | |
| f.write(result["text"]) | |
| bot.send_document(message.chat.id, open("output.srt","rb")) | |
| bot.infinity_polling() |