Update app.py
Browse files
app.py
CHANGED
@@ -90,13 +90,14 @@ def process_video(video_file, progress=gr.Progress()):
|
|
90 |
progress(0.8, desc="Retrieving results...")
|
91 |
|
92 |
# Retrieve transcription and insights
|
93 |
-
result = calls_table.select(calls_table.transcription_text, calls_table.insights).tail(1)
|
94 |
transcription = result['transcription_text'][0]
|
95 |
insights = result['insights'][0]
|
|
|
96 |
|
97 |
progress(1.0, desc="Processing complete")
|
98 |
|
99 |
-
return transcription, insights, "Processing complete"
|
100 |
|
101 |
except Exception as e:
|
102 |
return f"An error occurred during video processing: {str(e)}", ""
|
@@ -144,8 +145,8 @@ def chatbot_response(message, chat_history):
|
|
144 |
temp_table['chatbot_prompt'] = create_chatbot_prompt(context_text, temp_table.question)
|
145 |
temp_table['chatbot_response'] = openai.chat_completions(
|
146 |
messages=temp_table.chatbot_prompt,
|
147 |
-
model='gpt-
|
148 |
-
max_tokens=
|
149 |
)
|
150 |
temp_table['answer'] = temp_table.chatbot_response.choices[0].message.content
|
151 |
|
@@ -210,19 +211,23 @@ with gr.Blocks(theme=gr.themes.Base()) as demo:
|
|
210 |
with gr.Column(scale=2):
|
211 |
with gr.Tabs() as tabs:
|
212 |
with gr.TabItem("π Transcript"):
|
213 |
-
output_transcription = gr.Textbox(label="Call Transcription", lines=
|
214 |
|
215 |
with gr.TabItem("π‘ Insights"):
|
216 |
-
output_insights = gr.Textbox(label="Key Takeaways", lines=
|
|
|
|
|
|
|
217 |
|
218 |
-
with gr.TabItem("π
|
219 |
with gr.Row():
|
220 |
similarity_query = gr.Textbox(label="Search Query", placeholder="Enter a topic or phrase to search for")
|
221 |
num_results = gr.Slider(minimum=1, maximum=20, value=5, step=1, label="Number of Results")
|
222 |
similarity_search_btn = gr.Button("Search", variant="secondary")
|
223 |
similarity_results = gr.DataFrame(
|
224 |
headers=["Relevant Text", "Similarity Score"],
|
225 |
-
label="Search Results"
|
|
|
226 |
)
|
227 |
|
228 |
with gr.TabItem("π€ AI Assistant"):
|
@@ -246,7 +251,7 @@ with gr.Blocks(theme=gr.themes.Base()) as demo:
|
|
246 |
process_btn.click(
|
247 |
process_video,
|
248 |
inputs=[video_file],
|
249 |
-
outputs=[output_transcription, output_insights, status_output],
|
250 |
show_progress="full"
|
251 |
)
|
252 |
|
|
|
90 |
progress(0.8, desc="Retrieving results...")
|
91 |
|
92 |
# Retrieve transcription and insights
|
93 |
+
result = calls_table.select(calls_table.transcription_text, calls_table.insights, calls_table.audio).tail(1)
|
94 |
transcription = result['transcription_text'][0]
|
95 |
insights = result['insights'][0]
|
96 |
+
audio = result['audio'][0]
|
97 |
|
98 |
progress(1.0, desc="Processing complete")
|
99 |
|
100 |
+
return transcription, insights, audio, "Processing complete"
|
101 |
|
102 |
except Exception as e:
|
103 |
return f"An error occurred during video processing: {str(e)}", ""
|
|
|
145 |
temp_table['chatbot_prompt'] = create_chatbot_prompt(context_text, temp_table.question)
|
146 |
temp_table['chatbot_response'] = openai.chat_completions(
|
147 |
messages=temp_table.chatbot_prompt,
|
148 |
+
model='gpt-4o-mini-2024-07-18',
|
149 |
+
max_tokens=300
|
150 |
)
|
151 |
temp_table['answer'] = temp_table.chatbot_response.choices[0].message.content
|
152 |
|
|
|
211 |
with gr.Column(scale=2):
|
212 |
with gr.Tabs() as tabs:
|
213 |
with gr.TabItem("π Transcript"):
|
214 |
+
output_transcription = gr.Textbox(label="Call Transcription", lines=10)
|
215 |
|
216 |
with gr.TabItem("π‘ Insights"):
|
217 |
+
output_insights = gr.Textbox(label="Key Takeaways", lines=20)
|
218 |
+
|
219 |
+
with gr.TabItem("π΅ Audio"):
|
220 |
+
output_audio = gr.Audio(label="Extracted Audio", type="filepath")
|
221 |
|
222 |
+
with gr.TabItem("π Search"):
|
223 |
with gr.Row():
|
224 |
similarity_query = gr.Textbox(label="Search Query", placeholder="Enter a topic or phrase to search for")
|
225 |
num_results = gr.Slider(minimum=1, maximum=20, value=5, step=1, label="Number of Results")
|
226 |
similarity_search_btn = gr.Button("Search", variant="secondary")
|
227 |
similarity_results = gr.DataFrame(
|
228 |
headers=["Relevant Text", "Similarity Score"],
|
229 |
+
label="Search Results",
|
230 |
+
wrap=True
|
231 |
)
|
232 |
|
233 |
with gr.TabItem("π€ AI Assistant"):
|
|
|
251 |
process_btn.click(
|
252 |
process_video,
|
253 |
inputs=[video_file],
|
254 |
+
outputs=[output_transcription, output_insights, output_audio, status_output],
|
255 |
show_progress="full"
|
256 |
)
|
257 |
|