Spaces:
Build error
Build error
app.py
CHANGED
@@ -26,9 +26,7 @@ def get_transcript(link):
|
|
26 |
#input - question and transcript, output - answer timestamp
|
27 |
def get_answers_timestamp(question, final_transcript, transcript):
|
28 |
print("******** Inside get_answers_timestamp ********")
|
29 |
-
|
30 |
-
#tokenizer = AutoTokenizer.from_pretrained(model_ckpt) >>>>>>>>>>>>
|
31 |
-
#question = "any funny examples in video??"
|
32 |
context = final_transcript
|
33 |
print(f"Input Question is : {question}")
|
34 |
print(f"Type of trancript is : {type(context)}, Length of transcript is : {len(context)}")
|
@@ -42,7 +40,6 @@ def get_answers_timestamp(question, final_transcript, transcript):
|
|
42 |
#print(ques)
|
43 |
#print(contx)
|
44 |
|
45 |
-
#model = AutoModelForQuestionAnswering.from_pretrained(model_ckpt) >>>>>>>>>>>>>>
|
46 |
lst=[]
|
47 |
pipe = pipeline("question-answering", model=model, tokenizer=tokenizer)
|
48 |
for contexts in contx:
|
@@ -60,7 +57,6 @@ def get_answers_timestamp(question, final_transcript, transcript):
|
|
60 |
|
61 |
dftranscript = pd.DataFrame(transcript)
|
62 |
|
63 |
-
#modelST = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2') >>>>>>>>>>>>>>>>
|
64 |
embedding_1= modelST.encode(dftranscript.text, convert_to_tensor=True)
|
65 |
embedding_2 = modelST.encode(sentence_for_timestamp, convert_to_tensor=True)
|
66 |
embedding_3 = modelST.encode(sentence_for_timestamp_secondbest, convert_to_tensor=True)
|
@@ -123,7 +119,7 @@ with demo:
|
|
123 |
gr.Markdown(
|
124 |
"""### How many times have you seen a long video/podcast on Youtube and wondered only if there would have been 'explanatory' timestamps it would have been so much better..
|
125 |
**How to use this space:** You can either provide a new YouTube video link or can use the sample video link provided. Then provide a Questions that you would like about exploring the content in the given video.
|
126 |
-
The App will generate timestamps and Play the video at those timestamps for you in the space provided. You will see two video displays, corresponding to two of the best guesses by the underlying models. Chances are that both videos might start with same timestamp, which will depend on the question and the content in the video, please bear! Also,
|
127 |
|
128 |
**Motivation behind building this App:** When we see a long video without timestamps, we often wonder 'if' the content we are looking for is in there, or 'where' in the video is the content we are looking for? The Idea is that we might have questions like 'Is the xxxx thing covered in this video?', or maybe 'does the host talks about the architecture of the xxxxx model', or maybe 'Does host talk about alien doorway on Mars?' and so on.
|
129 |
|
|
|
26 |
#input - question and transcript, output - answer timestamp
|
27 |
def get_answers_timestamp(question, final_transcript, transcript):
|
28 |
print("******** Inside get_answers_timestamp ********")
|
29 |
+
|
|
|
|
|
30 |
context = final_transcript
|
31 |
print(f"Input Question is : {question}")
|
32 |
print(f"Type of trancript is : {type(context)}, Length of transcript is : {len(context)}")
|
|
|
40 |
#print(ques)
|
41 |
#print(contx)
|
42 |
|
|
|
43 |
lst=[]
|
44 |
pipe = pipeline("question-answering", model=model, tokenizer=tokenizer)
|
45 |
for contexts in contx:
|
|
|
57 |
|
58 |
dftranscript = pd.DataFrame(transcript)
|
59 |
|
|
|
60 |
embedding_1= modelST.encode(dftranscript.text, convert_to_tensor=True)
|
61 |
embedding_2 = modelST.encode(sentence_for_timestamp, convert_to_tensor=True)
|
62 |
embedding_3 = modelST.encode(sentence_for_timestamp_secondbest, convert_to_tensor=True)
|
|
|
119 |
gr.Markdown(
|
120 |
"""### How many times have you seen a long video/podcast on Youtube and wondered only if there would have been 'explanatory' timestamps it would have been so much better..
|
121 |
**How to use this space:** You can either provide a new YouTube video link or can use the sample video link provided. Then provide a Questions that you would like about exploring the content in the given video.
|
122 |
+
The App will generate timestamps and Play the video at those timestamps for you in the space provided. You will see two video displays, corresponding to two of the best guesses by the underlying models. Chances are that both videos might start with same timestamp, which will depend on the question and the content in the video, please bear! Also, couple small caveats, firstly the App will perform as good as the available English Transcripts are for the given YouTube Video. If there are no transcripts, the App will not work. Secondly, make sure the YouTube video links that you paste here don't have the trailing values like *&t=8077s*.
|
123 |
|
124 |
**Motivation behind building this App:** When we see a long video without timestamps, we often wonder 'if' the content we are looking for is in there, or 'where' in the video is the content we are looking for? The Idea is that we might have questions like 'Is the xxxx thing covered in this video?', or maybe 'does the host talks about the architecture of the xxxxx model', or maybe 'Does host talk about alien doorway on Mars?' and so on.
|
125 |
|