AhmadMustafa commited on
Commit
23fc48e
·
1 Parent(s): 21057c0

update: http if origin is localhost

Browse files
Files changed (1) hide show
  1. app.py +14 -5
app.py CHANGED
@@ -327,6 +327,10 @@ def get_initial_analysis(
327
  try:
328
  transcript = transcript_processor.get_transcript()
329
  client = OpenAI()
 
 
 
 
330
  if ct == "si": # street interview
331
  prompt = f"""This is a transcript for a street interview. Transcript: {transcript}
332
  In this street interview, the host asks multiple questions to the interviewees.
@@ -337,10 +341,10 @@ Question 1 should always be the introduction if the speaker has introduced thems
337
  Return format is:
338
  1. Question: question
339
  Number of takes: number
340
- Best Answer timestamp: [Timestamp: start_time - end_time](https://{{origin}}/collab/{{cid}}/{{rsid}}&st={{start_time_in_sec}}&et={{end_time_in_sec}}"').
341
  For Example:
342
  If the start time is 10:13 and end time is 10:18, the url will be:
343
- https://roll.ai/colab/1234aq_12314/51234151?st=613&et=618
344
  """
345
  else:
346
  prompt = f"""Given the transcript {transcript}, For All the speakers, short list all people, news, events, trends, and source that are discussed by speakers along with the start time of that topic and end time of that topic from the transcript. Rank all topics based on what would make for the best social clips. I need atleast 3 topics per speaker.
@@ -348,7 +352,7 @@ You should mention the Speaker Name first, then atleast 3 posts with their times
348
  Return format is:
349
  Speaker Name
350
  1.Topic: topic,
351
- [Timestamp: start_time - end_time](https://{{origin}}/collab/{{cid}}/{{rsid}}&st={{start_time_in_sec}}&et={{end_time_in_sec}}"').
352
  2....
353
  """
354
 
@@ -380,15 +384,20 @@ def chat(
380
  try:
381
  client = OpenAI()
382
 
 
 
 
 
 
383
  prompt = f"""You are a helpful assistant analyzing transcripts and generating timestamps and URL. Call ID is {cid}, Session ID is {rsid}, origin is {origin}, Call Type is {ct}.
384
  Transcript:\n{transcript_processor.get_transcript()}
385
  If a user asks timestamps for a specific topic, find the start time and end time of that specific topic and return answer in the format:
386
  Answer format:
387
- Topic: Heading [Timestamp: start_time - end_time](https://{{origin}}/collab/{{cid}}/{{rsid}}&st={{start_time_in_sec}}&et={{end_time_in_sec}}"').
388
 
389
  For Example:
390
  If the start time is 10:13 and end time is 10:18, the url will be:
391
- https://roll.ai/colab/1234aq_12314/51234151?st=613&et=618
392
  """
393
  messages = [{"role": "system", "content": prompt}]
394
 
 
327
  try:
328
  transcript = transcript_processor.get_transcript()
329
  client = OpenAI()
330
+ if "localhost" in origin:
331
+ link_start = "http"
332
+ else:
333
+ link_start = "https"
334
  if ct == "si": # street interview
335
  prompt = f"""This is a transcript for a street interview. Transcript: {transcript}
336
  In this street interview, the host asks multiple questions to the interviewees.
 
341
  Return format is:
342
  1. Question: question
343
  Number of takes: number
344
+ Best Answer timestamp: [Timestamp: start_time - end_time]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}&st={{start_time_in_sec}}&et={{end_time_in_sec}}"').
345
  For Example:
346
  If the start time is 10:13 and end time is 10:18, the url will be:
347
+ {link_start}://roll.ai/colab/1234aq_12314/51234151?st=613&et=618
348
  """
349
  else:
350
  prompt = f"""Given the transcript {transcript}, For All the speakers, short list all people, news, events, trends, and source that are discussed by speakers along with the start time of that topic and end time of that topic from the transcript. Rank all topics based on what would make for the best social clips. I need atleast 3 topics per speaker.
 
352
  Return format is:
353
  Speaker Name
354
  1.Topic: topic,
355
+ [Timestamp: start_time - end_time]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}&st={{start_time_in_sec}}&et={{end_time_in_sec}}"').
356
  2....
357
  """
358
 
 
384
  try:
385
  client = OpenAI()
386
 
387
+ if "localhost" in origin:
388
+ link_start = "http"
389
+ else:
390
+ link_start = "https"
391
+
392
  prompt = f"""You are a helpful assistant analyzing transcripts and generating timestamps and URL. Call ID is {cid}, Session ID is {rsid}, origin is {origin}, Call Type is {ct}.
393
  Transcript:\n{transcript_processor.get_transcript()}
394
  If a user asks timestamps for a specific topic, find the start time and end time of that specific topic and return answer in the format:
395
  Answer format:
396
+ Topic: Heading [Timestamp: start_time - end_time]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}&st={{start_time_in_sec}}&et={{end_time_in_sec}}"').
397
 
398
  For Example:
399
  If the start time is 10:13 and end time is 10:18, the url will be:
400
+ {link_start}://roll.ai/colab/1234aq_12314/51234151?st=613&et=618
401
  """
402
  messages = [{"role": "system", "content": prompt}]
403