AhmadMustafa commited on
Commit
6b83c96
·
1 Parent(s): 3df9cb1

update: prompt for live event accuracy

Browse files
Files changed (1) hide show
  1. app.py +49 -5
app.py CHANGED
@@ -335,7 +335,10 @@ def get_initial_analysis(
335
  link_start = "https"
336
  print(uid)
337
  if ct == "si": # street interview
338
- prompt = f"""This is a transcript for a street interview. Transcript: {transcript} User ID UID: {uid}
 
 
 
339
 
340
  Your task is to analyze this street interview transcript and identify the final/best timestamps for each topic or question discussed. Here are the key rules:
341
 
@@ -379,15 +382,56 @@ Total takes: 2
379
  - [Take 1. <div id='topic' style="display: inline"> 20s at 25:45]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{1245}}&et={{1265}}&uid={{uid}}))
380
  - [Take 3 (Best). <div id='topic' style="display: inline"> 5s at 10:13 </div>]({link_start}://roll.ai/colab/1234aq_12314/51234151?st=613&et=618&uid=82314)"""
381
  else:
382
- prompt = f"""Given the transcript {transcript}, user id UID: {uid} analyze speakers' discussions to identify compelling social media clips. For each speaker, identify key topics that mention people, news, events, trends, or sources.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
 
384
  Format requirements:
385
 
386
  1. SPEAKER FORMAT:
387
  **Speaker Name**
388
- 1. [Topic title <div id='topic' style="display: inline"> 20s at 12:30 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{750}}&et={{770}}&uid={{uid}}))
389
- 2. [Topic title <div id='topic' style="display: inline"> 45s at 14:45 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{885}}&et={{930}}&uid={{uid}}))
390
- 3. [Topic title <div id='topic' style="display: inline"> 55s at 16:20 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{980}}&et={{1035}}&uid={{uid}}))
391
 
392
  2. TIMESTAMP RULES:
393
  - Start time (st): Must begin exactly when speaker starts discussing the specific topic
 
335
  link_start = "https"
336
  print(uid)
337
  if ct == "si": # street interview
338
+ prompt = f"""This is a transcript for a street interview. Call Details are as follows:
339
+ User ID UID: {uid}
340
+ Speakers: {", ".join(speaker_mapping.values())}
341
+ Transcript: {transcript}
342
 
343
  Your task is to analyze this street interview transcript and identify the final/best timestamps for each topic or question discussed. Here are the key rules:
344
 
 
382
  - [Take 1. <div id='topic' style="display: inline"> 20s at 25:45]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{1245}}&et={{1265}}&uid={{uid}}))
383
  - [Take 3 (Best). <div id='topic' style="display: inline"> 5s at 10:13 </div>]({link_start}://roll.ai/colab/1234aq_12314/51234151?st=613&et=618&uid=82314)"""
384
  else:
385
+ topic_identification_prompt = f"""Given the transcript {transcript}, identify compelling social media clip topics for each speaker.
386
+
387
+ For each speaker, analyze their dialogue and list 2-3 most engaging topics they discussed that would make viral social media content.
388
+
389
+ Format:
390
+ **Speaker Name**
391
+ 1. Topic title: [Brief description of the specific discussion point]
392
+ 2. Topic title: [Brief description of the specific discussion point]
393
+ 3. Topic title: [Brief description of the specific discussion point]
394
+
395
+ Requirements:
396
+ - Each topic should be a distinct, self-contained discussion
397
+ - Topics should mention people, news, events, trends, or sources
398
+ - Skip the host if no compelling content
399
+ - Topics should be substantial enough for 20-60 second clips
400
+ """
401
+
402
+ topics_completion = client.chat.completions.create(
403
+ model="gpt-4o-mini",
404
+ messages=[
405
+ {
406
+ "role": "system",
407
+ "content": """You are analyzing a transcript to identify engaging social media clip topics.
408
+ Focus on finding viral-worthy, substantial content that can be turned into 20-60 second clips.
409
+ Avoid mundane or generic content.""",
410
+ },
411
+ {"role": "user", "content": topic_identification_prompt},
412
+ ],
413
+ stream=False,
414
+ temperature=0.3,
415
+ )
416
+
417
+ topics_result = topics_completion.choices[0].message.content
418
+
419
+ prompt = f"""Call Details:
420
+ Call ID: {cid}
421
+ Speakers: {", ".join(speaker_mapping.values())}
422
+ Transcript: {transcript}
423
+ Using the following list of identified topics:
424
+ {topics_result}
425
+
426
+ Find the exact timestamps in the above transcript where each speaker discusses these specific topics.
427
 
428
  Format requirements:
429
 
430
  1. SPEAKER FORMAT:
431
  **Speaker Name**
432
+ 1. [Topic title <div id='topic' style="display: inline"> 20s at 12:30 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{750}}&et={{770}}&uid={{uid}})
433
+ 2. [Topic title <div id='topic' style="display: inline"> 45s at 14:45 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{885}}&et={{930}}&uid={{uid}})
434
+ 3. [Topic title <div id='topic' style="display: inline"> 55s at 16:20 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{980}}&et={{1035}}&uid={{uid}})
435
 
436
  2. TIMESTAMP RULES:
437
  - Start time (st): Must begin exactly when speaker starts discussing the specific topic