KwabsHug commited on
Commit
e5579ec
1 Parent(s): 41df859

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -1
app.py CHANGED
@@ -152,11 +152,55 @@ def WikiSearch(term):
152
  result = wikipedia.search(item, results=20)
153
  return result
154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  with gr.Blocks() as lliface:
156
  with gr.Tab("Welcome "):
157
  gr.HTML("<h1> Spaces Test - Still Undercontruction </h1> <p> You only learn when you convert things you dont know to known --> Normally Repetition is the only reliable method for everybody </p> <p> Knowledge is a Language </p> <p>LingQ is good option for per word state management</p> <p> Arrows app json creator for easy knowledge graphing and spacy POS graph? </p> <p> https://huggingface.co/spaces/RASMUS/Whisper-youtube-crosslingual-subtitles<br>, https://huggingface.co/spaces/vumichien/whisper-speaker-diarization<br> Maybe duplicate these, private them and then load into spaces? --> Whisper space for youtube, Clip Interrogator, load here and all my random functions esp. text to HTML </p>")
158
  with gr.Tab("LingQ Addons ideas"):
159
- gr.HTML("Extra functions needed - Persitent Sentence translation, UNWFWO, POS tagging and Word Count per user of words in their account")
 
 
 
 
 
 
 
 
 
 
 
160
  with gr.Tab("Transcribe - RASMUS Whisper"):
161
  gr.HTML("""<p>If this tab doesnt work use the link below ⬇️</p> <a href="https://huggingface.co/spaces/RASMUS/Whisper-youtube-crosslingual-subtitles">https://huggingface.co/spaces/RASMUS/Whisper-youtube-crosslingual-subtitles</a>""")
162
  gr.Interface.load("spaces/RASMUS/Whisper-youtube-crosslingual-subtitles", title="Subtitles")
 
152
  result = wikipedia.search(item, results=20)
153
  return result
154
 
155
+ import re
156
+
157
+ def find_string_positions(s, string):
158
+ positions = []
159
+ start = 0
160
+ while True:
161
+ position = s.find(string, start)
162
+ if position == -1:
163
+ break
164
+ positions.append(position)
165
+ start = position + len(string)
166
+ return positions
167
+
168
+ def splittext(string, split_positions):
169
+ split_strings = []
170
+ prepos = 0
171
+ for pos in split_positions:
172
+ pos -= 12
173
+ split_strings.append((string[prepos:pos])) #, string[pos:]))
174
+ prepos = pos
175
+
176
+ FinalOutput = ""
177
+ stoutput = ""
178
+ linenumber = 1
179
+ print(linenumber)
180
+ for item in split_strings[1:]:
181
+ stoutput = item[0:29] + "\n" + item[30:]
182
+ stspaces = find_string_positions(stoutput, " ")
183
+ FinalOutput += str(linenumber) + "\n" + stoutput[:stspaces[-2]] + "\n"
184
+ FinalOutput += "\n"
185
+ linenumber += 1
186
+ return FinalOutput[2:]
187
+
188
  with gr.Blocks() as lliface:
189
  with gr.Tab("Welcome "):
190
  gr.HTML("<h1> Spaces Test - Still Undercontruction </h1> <p> You only learn when you convert things you dont know to known --> Normally Repetition is the only reliable method for everybody </p> <p> Knowledge is a Language </p> <p>LingQ is good option for per word state management</p> <p> Arrows app json creator for easy knowledge graphing and spacy POS graph? </p> <p> https://huggingface.co/spaces/RASMUS/Whisper-youtube-crosslingual-subtitles<br>, https://huggingface.co/spaces/vumichien/whisper-speaker-diarization<br> Maybe duplicate these, private them and then load into spaces? --> Whisper space for youtube, Clip Interrogator, load here and all my random functions esp. text to HTML </p>")
191
  with gr.Tab("LingQ Addons ideas"):
192
+ gr.HTML("Extra functions needed - Persitent Sentence translation, UNWFWO, POS tagging and Word Count per user of words in their account")
193
+ with gr.Row():
194
+ with gradio.Column(scale=1):
195
+ gr.TextArea(title="Paste Roman")
196
+ with gradio.Column(scale=1):
197
+ gr.TextArea(title="Paste Word 4 Word")
198
+ with gradio.Column(scale=1):
199
+ gr.TextArea(title="Paste Full Meaning")
200
+ with gradio.Column(scale=1):
201
+ gr.TextArea(title="Macaronic Text")
202
+ with gr.Row():
203
+ gr.Interface()
204
  with gr.Tab("Transcribe - RASMUS Whisper"):
205
  gr.HTML("""<p>If this tab doesnt work use the link below ⬇️</p> <a href="https://huggingface.co/spaces/RASMUS/Whisper-youtube-crosslingual-subtitles">https://huggingface.co/spaces/RASMUS/Whisper-youtube-crosslingual-subtitles</a>""")
206
  gr.Interface.load("spaces/RASMUS/Whisper-youtube-crosslingual-subtitles", title="Subtitles")