Prthameshh commited on
Commit
a5a12ec
1 Parent(s): a0d86cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -155
app.py CHANGED
@@ -1,8 +1,6 @@
1
 
2
  import json
3
- import re
4
- # from crewai import Agent, Task, Process,Crew
5
- # from langchain_groq import ChatGroq
6
  import tempfile
7
  import os
8
  import streamlit as st
@@ -17,17 +15,8 @@ load_dotenv()
17
  # Access the API key
18
  DG_KEY = os.getenv("DG_KEY")
19
 
20
-
21
-
22
- # # Initialize the Deepgram client
23
- # DG_KEY = "88b968f3e3cfc8eaf5a596e15c579ffca9a59aed"
24
  deepgram = DeepgramClient(DG_KEY)
25
 
26
- # #creating llm
27
- # llm = ChatGroq(
28
- # model_name="llama3-8b-8192",
29
- # api_key= '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'
30
- # )
31
 
32
  # Function to transcribe an audio file
33
  def transcribe_audio_file(audio_file_path):
@@ -109,145 +98,7 @@ def transcribe_and_process_audio(audio_file_path):
109
  temp_file.write(line.encode('utf-8'))
110
 
111
  return transcription
112
- # #creating class for agent and task
113
- # class meeting_assistant():
114
- # def meeting_assistant(self):
115
- # return Agent(
116
- # role='expert meeting assistant',
117
- # goal='Your goal is to understand the complete meeting conversation and extract important information such as summary, key points discussed, key action item and owener of action item with agreed schedule, meeting sentiment analysis ',
118
- # backstory=('''With the critical eye on the each discussed topic in the meeting.
119
- # You provide an exact parts of coversation where the key points are discussed.
120
- # you identify them with strong experience in understanding the conversation.
121
- # You provide a overall sentiment analysis of the meeting.
122
- # You recognise an idividual who owns the responsibility of a perticular action and also agrees to a schedule on which he/she takes/completes the action.
123
- # '''
124
- # ),
125
- # verbose=False,
126
- # max_iter=20,
127
- # allow_delegation=False,
128
- # llm = llm
129
- # )
130
-
131
- # class assisatnt_tasks():
132
- # def meeting_assistance_task(self, agent):
133
- # return Task(
134
- # description=(
135
- # '''
136
- # "Analyze the provided conversation text {text} of a meeting and extract the following key information:"
137
- # "1. Summary: Provide a concise summary of the entire meeting, capturing the main topics discussed and the overall purpose of the meeting."
138
- # "2. Key Points Discussed: Identify and list the key points discussed during the meeting. These should be the main ideas or topics that were addressed, without including minor details."
139
- # "3. Key Action Items: Extract the key action items that were agreed upon during the meeting. For each action item, include the following details:"
140
- # " a. Description of the action item."
141
- # " b. Owner of the action item (the person responsible for completing the task)."
142
- # " c. Agreed schedule (the deadline or time frame within which the action item should be completed)."
143
- # "4. Meeting Sentiment Analysis: Perform sentiment analysis on the meeting conversation. Determine the overall sentiment (positive, negative, neutral) and provide specific examples or quotes that illustrate the sentiment."
144
- # "Provide the output strictly in the following structured format:"
145
- # "{meeting_structure}"
146
-
147
- # "Ensure the information is clear, concise, and accurately reflects the content of the meeting conversation in a given {meeting_structure}."
148
- # '''
149
- # ),
150
- # expected_output=(
151
- # 'A structured output as a {meeting_structure} highlighting the summary, key points discussed, key action items with owners and agreed schedules, and meeting sentiment analysis.'
152
- # ),
153
- # allow_delegation=False,
154
- # agent=agent
155
- # )
156
- # # structure of outputs
157
- # meeting_structure='''
158
- # {
159
- # "Summary": "A detailed summary of the meeting.",
160
- # "KeyPointsDiscussed": [
161
- # "First key point discussed in the meeting.",
162
- # "Second key point discussed in the meeting.",
163
- # "Third key point discussed in the meeting."
164
- # ],
165
- # "ActionItems": [
166
- # {
167
- # "Description": "Description of the action to be taken.",
168
- # "Owner": "Name of the owner responsible.",
169
- # "DueDate": "Date or time mentioned for completion."
170
- # },
171
- # {
172
- # "Description": "Description of the action to be taken.",
173
- # "Owner": "Name of the owner responsible.",
174
- # "DueDate": "Date or time mentioned for completion."
175
- # }
176
- # ],
177
- # "SentimentAnalysis": {
178
- # "OverallSentiment": "Overall sentiment of the meeting (e.g., positive, negative, neutral).",
179
- # "Comments": "Specific comments related to the sentiment."
180
- # }
181
- # }'''
182
-
183
- # #calling classes
184
- # agent = meeting_assistant()
185
- # task = assisatnt_tasks()
186
- # # Call the agent methods to get BaseAgent instances
187
- # meeting_agent = agent.meeting_assistant()
188
- # meeting_task = task.meeting_assistance_task(meeting_agent)
189
-
190
- # def text_analysis(text):
191
- # crew = Crew(agents=[meeting_agent],
192
- # tasks=[meeting_task],
193
- # process= Process.sequential,
194
- # verbose=False
195
- # )
196
- # output = crew.kickoff(inputs={'text':text, 'meeting_structure':meeting_structure})
197
- # # Extract the raw output as a string
198
- # output_string = output.raw
199
- # return output_string
200
-
201
- # #formatting the jsonstring
202
- # def format_json_output(output_str):
203
- # # Apply regex to extract JSON part
204
- # json_str = re.search(r'{.*}', output_str, re.DOTALL).group(0)
205
-
206
- # # Convert the cleaned string to a JSON object
207
- # try:
208
- # json_obj = json.loads(json_str)
209
- # except json.JSONDecodeError:
210
- # return "Invalid JSON format"
211
-
212
- # # Define the format
213
- # formatted_text = []
214
-
215
- # # Add summary
216
- # formatted_text.append(f"Summary:\n{json_obj.get('Summary', 'No summary available')}\n")
217
-
218
- # # Add Key Points Discussed
219
- # formatted_text.append("Key Points Discussed:")
220
- # key_points = json_obj.get('KeyPointsDiscussed', [])
221
- # if key_points:
222
- # for point in key_points:
223
- # formatted_text.append(f" - {point}")
224
- # else:
225
- # formatted_text.append(" No key points discussed")
226
- # formatted_text.append("")
227
-
228
- # # Add Action Items
229
- # formatted_text.append("Action Items:")
230
- # action_items = json_obj.get('ActionItems', [])
231
- # if action_items:
232
- # for item in action_items:
233
- # description = item.get('Description', 'No description')
234
- # owner = item.get('Owner', 'No owner')
235
- # due_date = item.get('DueDate', 'No due date')
236
- # formatted_text.append(f" - {description}\n Owner: {owner}\n Due Date: {due_date}")
237
- # else:
238
- # formatted_text.append(" No action items")
239
- # formatted_text.append("")
240
-
241
- # # Add Sentiment Analysis
242
- # sentiment_analysis = json_obj.get('SentimentAnalysis', {})
243
- # overall_sentiment = sentiment_analysis.get('OverallSentiment', 'No sentiment analysis')
244
- # comments = sentiment_analysis.get('Comments', 'No comments')
245
-
246
- # formatted_text.append(f"Sentiment Analysis:\n Overall Sentiment: {overall_sentiment}\n Comments: {comments}")
247
-
248
- # # Join and return the formatted text
249
- # return "\n".join(formatted_text)
250
-
251
 
252
 
253
 
@@ -271,7 +122,4 @@ if uploaded_file is not None:
271
  st.write("Transcription:")
272
  st.text(transcription)
273
 
274
- # st.write('text_analysis')
275
- # output_string = text_analysis(transcription)
276
- # formatted_string = format_json_output(output_string)
277
- # st.write(formatted_string)
 
1
 
2
  import json
3
+ import re
 
 
4
  import tempfile
5
  import os
6
  import streamlit as st
 
15
  # Access the API key
16
  DG_KEY = os.getenv("DG_KEY")
17
 
 
 
 
 
18
  deepgram = DeepgramClient(DG_KEY)
19
 
 
 
 
 
 
20
 
21
  # Function to transcribe an audio file
22
  def transcribe_audio_file(audio_file_path):
 
98
  temp_file.write(line.encode('utf-8'))
99
 
100
  return transcription
101
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
 
104
 
 
122
  st.write("Transcription:")
123
  st.text(transcription)
124
 
125
+