ysharma HF staff commited on
Commit
28d279e
1 Parent(s): b69cb8c
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -5,6 +5,7 @@ import os
5
  import json
6
  import base64
7
  import requests
 
8
 
9
  API_URL = "https://api-inference.huggingface.co/models/facebook/wav2vec2-base-960h"
10
  #headers = {"Authorization": "Bearer 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"}
@@ -34,7 +35,7 @@ def generate_transcripts(in_video): #generate_gifs(in_video, gif_transcript):
34
 
35
  #getting words and word timestamps
36
  words, words_timestamp = get_word_timestamps(timestamps)
37
- print(f"Total words in the audio transcript is:{len(words)}, transcript word list is :{words}")
38
  print(f"Total Word timestamps derived fromcharacter timestamp are :{len(words_timestamp)}, Word timestamps are :{words_timestamp}")
39
 
40
  return transcription, words, words_timestamp
@@ -49,7 +50,10 @@ def generate_gifs(gif_transcript, words, words_timestamp):
49
  giflist = gif.split()
50
 
51
  #getting gif indexes from the generator
 
 
52
  print(f"words is :{words}")
 
53
  print(f"length of words is :{len(words)}")
54
  print(f"giflist is :{giflist}")
55
  #print(f"haystack and needle function returns value as : {list(get_gif_word_indexes(words, giflist))}")
 
5
  import json
6
  import base64
7
  import requests
8
+ import ast
9
 
10
  API_URL = "https://api-inference.huggingface.co/models/facebook/wav2vec2-base-960h"
11
  #headers = {"Authorization": "Bearer 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"}
 
35
 
36
  #getting words and word timestamps
37
  words, words_timestamp = get_word_timestamps(timestamps)
38
+ print(f"Total words in the audio transcript is:{len(words)}, transcript word list is :{words}, type of words is :{type(words)} ")
39
  print(f"Total Word timestamps derived fromcharacter timestamp are :{len(words_timestamp)}, Word timestamps are :{words_timestamp}")
40
 
41
  return transcription, words, words_timestamp
 
50
  giflist = gif.split()
51
 
52
  #getting gif indexes from the generator
53
+ # Converting string to list
54
+ words = ast.literal_eval(words)
55
  print(f"words is :{words}")
56
+ print(f"type of words is :{type(words)}")
57
  print(f"length of words is :{len(words)}")
58
  print(f"giflist is :{giflist}")
59
  #print(f"haystack and needle function returns value as : {list(get_gif_word_indexes(words, giflist))}")