akshay-js commited on
Commit
0077bbf
β€’
1 Parent(s): 3ec9829

Added application

Browse files
Files changed (3) hide show
  1. README.md +26 -6
  2. app.py +71 -0
  3. requirements.txt +4 -0
README.md CHANGED
@@ -1,12 +1,32 @@
1
  ---
2
- title: Meeting Minute Generator And Question And Answer Chatbot
3
- emoji: 😻
4
- colorFrom: yellow
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 4.36.1
8
  app_file: app.py
9
  pinned: false
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Meeting Minutes Generator and Question Answer Application
3
+ emoji: πŸ‘€
4
+ colorFrom: pink
5
+ colorTo: pink
6
  sdk: gradio
 
7
  app_file: app.py
8
  pinned: false
9
  ---
10
 
11
+ ## Overview
12
+
13
+ This application takes an MP3 file of a meeting recording in English, converts it into text, generates meeting minutes in a specified format, and answers questions based on the minutes using OpenAI APIs, ChatGPT, and the LangChain framework.
14
+
15
+ ## Features
16
+
17
+ - **Transcription**: Converts audio recordings (MP3) to text.
18
+ - **Meeting Minutes Generation**: Summarizes the transcription into meeting minutes.
19
+ - **Question and Answer**: Allows users to ask questions based on the meeting minutes.
20
+
21
+ ## Prerequisites
22
+
23
+ Before you begin, ensure you have met the following requirements:
24
+
25
+ - Python 3.7 or higher
26
+ - An OpenAI API key
27
+ - The following Python libraries:
28
+ - `openai`
29
+ - `transformers`
30
+ - `langchain`
31
+ - `pydub`
32
+ - `whisper`
app.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+ import torchaudio
4
+ import time
5
+
6
+ # Load Whisper ASR model
7
+ transcriber = pipeline(model="openai/whisper-base")
8
+
9
+ # Load summarization model
10
+ summarization_model = pipeline("summarization")
11
+
12
+ # Load question-answering model
13
+ model_name = "deepset/roberta-base-squad2"
14
+ nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
15
+
16
+ def translate_audio(audio):
17
+ # Step 1: Transcribe audio to text
18
+ transcription = transcriber(audio)
19
+ print('transcription', transcription)
20
+
21
+ # Step 2: Translate text to Hindi
22
+ summary = summarization_model(transcription['text'])
23
+ print('summary', summary)
24
+
25
+ return transcription['text'], summary[0]['summary_text']
26
+
27
+ def answer_question(context, question):
28
+ QA_input = {
29
+ 'question': question,
30
+ 'context': context
31
+ }
32
+ print('----QA_input----', QA_input)
33
+ return nlp(QA_input)['answer']
34
+
35
+ # Create Gradio interface
36
+ with gr.Blocks() as iface:
37
+ gr.Markdown("# Audio Translator, Summarizer, and QA System")
38
+
39
+ with gr.Row():
40
+ audio_input = gr.Audio(type="filepath", label="Upload Audio")
41
+ transcription_output = gr.Textbox(
42
+ label="Transcribed Text",
43
+ info="Initial text")
44
+ translation_output = gr.Textbox(
45
+ label="Summary",
46
+ info="Meeting minute")
47
+
48
+ translate_button = gr.Button("Translate Audio")
49
+
50
+ translate_button.click(
51
+ translate_audio,
52
+ inputs=[audio_input],
53
+ outputs=[transcription_output, translation_output]
54
+ )
55
+
56
+ def respond(message, chat_history, context):
57
+ bot_message = answer_question(context, message)
58
+ print('----bot_message---', bot_message)
59
+ chat_history.append((message, bot_message))
60
+ time.sleep(2)
61
+ return "", chat_history
62
+
63
+ with gr.Blocks() as demo:
64
+ chatbot = gr.Chatbot()
65
+ msg = gr.Textbox()
66
+ clear = gr.ClearButton([msg, chatbot])
67
+
68
+ msg.submit(respond, [msg, chatbot, transcription_output], [msg, chatbot])
69
+
70
+ # Launch the app
71
+ iface.launch(share=True) # 'share=True' to get a public link
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ transformers
2
+ torchaudio
3
+ gradio
4
+ sentencepiece