From 5ab72832847e7670342d50946e901915cc5649b7 Mon Sep 17 00:00:00 2001 From: Sethu Date: Mon, 19 Aug 2024 17:45:44 +0530 Subject: [PATCH] Revamped the whole code, now you can record voice or upload audio file to transcribe, translate and summarize the audio --- transcribe_audio.py | 5 ----- translate_text.py | 17 ----------------- 2 files changed, 22 deletions(-) delete mode 100644 transcribe_audio.py delete mode 100644 translate_text.py diff --git a/transcribe_audio.py b/transcribe_audio.py deleted file mode 100644 index beb3623..0000000 --- a/transcribe_audio.py +++ /dev/null @@ -1,5 +0,0 @@ -def transcribe_audio(model, audio_data): - options = dict(beam_size=5, best_of=5) - transcribe_options = dict(task="transcribe", **options) - transcript = model.transcribe(audio_data, **transcribe_options) - return transcript["text"] diff --git a/translate_text.py b/translate_text.py deleted file mode 100644 index 5c2d5b5..0000000 --- a/translate_text.py +++ /dev/null @@ -1,17 +0,0 @@ -#import openai -from config import openai_api_key - -#openai.api_key = openai_api_key - -def translate_text(text): - prompt = f"Translate the following text from given audio language to English:\n\n{text}" - response = openai.chat.completions.create( - model="gpt-3.5-turbo", - messages=[ - {"role": "system", "content": "You are a helpful assistant that translates text from Indian languages to English."}, - {"role": "user", "content": prompt} - ], - max_tokens=150 - ) - translated_text = response.choices[0].message.content - return translated_text