KwabsHug commited on
Commit
cdbd74c
1 Parent(s): 95b04d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +238 -92
app.py CHANGED
@@ -16,6 +16,8 @@ from collections import Counter
16
  from PIL import Image, ImageDraw, ImageFont
17
  import numpy as np
18
  from docx import Document
 
 
19
 
20
  #Uncomment these for Huggingface
21
  nltk.download('maxent_ne_chunker') #Chunker
@@ -325,6 +327,7 @@ def split_srt_file(text, lang): #file_path):
325
  subtitle_text = ' | '.join(section_lines[2:])
326
  sub_split_line = nlp(subtitle_text)
327
  subtitle_textPOSversion = ""
 
328
 
329
  # Replace spaces in the subtitle text with " | "
330
  #subtitle_text = subtitle_text.replace(' ', ' | ')
@@ -435,12 +438,12 @@ def text_to_links(text): #TextCompFormat
435
  html = ""
436
  for line in lines:
437
  if line.startswith("http"):
438
- html += f"<a href='{line}'>{line}</a><br> \n"
439
  else:
440
  html += line + "Not a link <br> \n"
441
  return html
442
 
443
- HTMLCompMode = gr.Dropdown(choices=["Dropdown", "Links"], value="Dropdown")
444
 
445
  def TextCompFormat(text, HTMLCompMode):
446
  FinalOutput = ""
@@ -625,7 +628,13 @@ def UnknownTrackTexttoApp(text): #Copy of def OptimisedTtAppForUNWFWO(text):
625
  '''
626
 
627
  FinalOutput = FinalHTML + FinalCSS + FinalJS
628
- return FinalOutput, FinalOutput
 
 
 
 
 
 
629
 
630
  #Kathryn Lingel - Pyambic Pentameter Example - PyCon US
631
  #Basic Language Model Code
@@ -657,6 +666,110 @@ def markov_generate(source_text, num_words = 20):
657
  return ' '.join(output) #New list into a string aka (hopefully) sentence
658
  # print(markov_generate("I am the egg man they are the egg men I am the wallrus goo goo g' joob"))
659
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
660
 
661
  # Define the Gradio interface inputs and outputs for video split
662
  spvvideo_file_input = gr.File(label='Video File')
@@ -665,97 +778,130 @@ spvdownload_output = gr.File(label='Download Segmented Files')
665
 
666
  Markovlength = gr.Number(value=30, label='Length of generation')
667
 
668
-
669
  groupinput_text = gr.Textbox(lines=2, label="Enter a list of words")
670
  groupoutput_text = gr.Textbox(label="Grouped words")
671
 
672
- with gr.Blocks() as lliface:
673
- gr.HTML("<p> Target 1: Dual audio at word Level while using repitition to train random recall --> Word level Time <br> Target 2: Video --> Split by sentence --> each word repeated (60) + each phrase (10) + each sentence (10) --> TTS file for practice --> State Management/Known word Tracker <hr> The trick is minimum one minute of focus on a new word --> Listening is hard because there are new word within seconds and you need repeated focus on each to learn </p> <p>Audio = best long form attention mechanism AS it is ANTICIPATION (Awareness of something before it happens like knowing song Lyrics) FOCUSED - Attention (Focused Repitition) + Exposure (Random Repitition) </p>")
674
- gr.HTML("""<hr> <a href="https://translate.google.com/?hl=en&tab=TT"> -- Google Translate -- </a> | <a href='https://huggingface.co/spaces/damo-vilab/modelscope-text-to-video-synthesis'> -- Modelscope Text to Video -- </a> | <a href='https://huggingface.co/spaces/stabilityai/stable-diffusion'> -- stable-diffusion 2 -- </a> | <a href='https://huggingface.co/spaces/stabilityai/stable-diffusion-1'> -- stable-diffusion 1 -- </a> | <a href='https://huggingface.co/spaces/kakaobrain/karlo'> -- karlo 1 -- </a>""")
675
- with gr.Tab("Welcome"):
676
- gr.HTML("""<p>Spaces Test - Still Undercontruction | Knowledge is a Language but productive knowledge is find replace as well | LingQ is good option for per word state management</p> <p> Arrows app json creator for easy knowledge graphing and spacy POS graph? --> Questions? -->
677
- <p> ChatGPT Turns Learning into a read only what you dont know ask only what you dont know feedback loop --> All you have to do is keep track of what prompts you have asked in the past</p> """)
678
- gr.HTML("Timing Practice - Repitition <hr> <p>Run from it, Dread it, Repitition is inevitable - Thanos --> Next Milestone is Turning this interface handsfree</p>")
679
- gr.Interface(fn=group_words, inputs=groupinput_text, outputs=groupoutput_text, description="Word Grouping and Rotation - Group a list of words into sets of 10 and rotate them every 60 seconds.") #.queue()
680
- gr.HTML("""HTML Version <hr> <iframe height="1200" style="width: 100%;" scrolling="no" title="Memorisation Aid" src="https://codepen.io/kwabs22/embed/preview/GRXKQgj?default-tab=result&editable=true" frameborder="no" loading="lazy" allowtransparency="true" allowfullscreen="true">
681
- See the Pen <a href="https://codepen.io/kwabs22/pen/GRXKQgj"> Memorisation Aid</a> by kwabs22 (<a href="https://codepen.io/kwabs22">@kwabs22</a>) on <a href="https://codepen.io">CodePen</a>. </iframe>""")
682
- with gr.Tab("Transition is the end goal"):
683
- gr.HTML("Transition is the true nature of logic i.e. like some form of non-semantic embedding that is semantic?")
684
- gr.Interface(fn=build_model, inputs="text", outputs=["text", "text"], description="Create Collocation Dictionary --> Google Kathryn Lingel - Pyambic Pentameter Example - PyCon US for more")
685
- gr.Interface(fn=markov_generate, inputs=["text", Markovlength], outputs="text", description="Generate Text based on the collocations in the text")
686
- with gr.Tab("Unknown Tracker"):
687
- gr.HTML("Repitition of things you know is a waste of time when theres stuff you dont know <p> In Language the goal is bigger vocab --> Knowledge equivalent = question answer pairs but to get to those you need related information pairs</p> <p> Vocab = Glossary + all non text wall(lists, diagrams, etc.)</p>")
688
- gr.Textbox("Placeholder for a function that creates a set list and can takes a list for known words and auto find replaces the stuff you know out of the content")
689
- gr.Interface(fn=UnknownTrackTexttoApp, inputs="text", outputs=["html", "text"], description="Use the text from here to create lists you use for the TTS section")
690
- with gr.Tab("Unique word ID - use in Infranodus"):
691
- gr.Interface(fn=unique_word_count, inputs="text", outputs="text", description="Wordcounter")
692
- gr.Interface(fn=SepHypandSynExpansion, inputs="text", outputs=["text", "text"], description="Word suggestions - Analyse the unique words in infranodus")
693
- gr.Interface(fn=WikiSearch, inputs="text", outputs="text", description="Unique word suggestions(wiki articles)")
694
- with gr.Tab("Automating related information linking"):
695
- gr.HTML("Questions - Tacking and suggesting questions to ask = new education")
696
- with gr.Tab("Beginner - Listen + Read"):
697
- with gr.Tab("Listening - Songs - Chorus"):
698
- gr.HTML("Anticipation of the item to remember is how you learn lyrics that is why songs are easy as if you heard it 10 times already your capacity to anticipate the words is great <br><br> This is where TTS helps as you are ignoring all words except the words just before the actual <hr>")
699
- gr.HTML("<p>Fastest way to learn words = is to have your own sound reference --> probably why babies learn fast as they make random noise</p> <p>If you know the flow of the song you can remember the spelling easier</p><p>Essentially if the sounds are repeated or long notes they are easy to remember</p>")
700
- gr.Interface(fn=AutoChorusInvestigator, inputs="text", outputs="text", description="Paste Full Lyrics to try find only chorus lines")
701
- gr.Interface(fn=AutoChorusPerWordScheduler, inputs="text", outputs="text", description="Create order of repitition for tts practice")
702
- gr.Interface(fn=TTSforListeningPractice, inputs=["text", TTSLangOptions], outputs="audio", description="Placeholder - paste chorus here and use TTS or make notes to save here")
703
- with gr.Tab("Reading - Caption images (SD/Dalle-E)"):
704
- gr.HTML("Predictable to identify the parts of picture being described --> The description moves in one direction from one side of the image to the other side is easiest <hr>")
705
- gr.HTML("Image = instant comprehension like Stable Diffusion --> Audiovisual experience is the most optimal reading experience <br> Manga with summary descriptions for the chapters = Most aligned visual to audio experience")
706
- gr.HTML("""<a href="https://huggingface.co/spaces/pharma/CLIP-Interrogator"> --Huggingface CLIP-Interrogator Space-- </a><br> """)
707
- gr.Interface(fn=removeTonalMarks, inputs="text", outputs="text", description="For text with characters use this function to remove any conflicting characters (if error below)")
708
- gr.Interface(fn=add_text_to_image , inputs=["image", "text"], outputs="image", description="Create Annotated images (Can create using stable diffusion and use the prompt)")
709
- gr.HTML("Use Shift Enter To put text on new lines if the text doesnt fit <hr>")
710
- #with gr.Tab("Transcribe - RASMUS Whisper"):
711
- #gr.Interface.load("spaces/RASMUS/Whisper-youtube-crosslingual-subtitles", title="Subtitles")
712
- with gr.Tab("Advanced - LingQ Addon Ideas"):
713
- with gr.Tab("Audio - Only English thoughts as practice"):
714
- gr.HTML("For Audio Most productive is real time recall of native (where your full reasoning ability will always be) <br><hr> Find Replace new lines of the foreign text with full stops or | to get per word translation")
715
- gr.Interface(fn=TTSforListeningPractice, inputs=["text", TTSLangOptions2], outputs="audio", description="Paste only english words in foreign order and then keep removing the words from this to practice as effectively")
716
- with gr.Tab("Visual - Multiline Custom Video Subtitles"):
717
- gr.HTML("LingQ Companion Idea - i.e. Full Translation Read along, and eventually Videoplayer watch along like RAMUS whisper space <br><br>Extra functions needed - Persitent Sentence translation, UNWFWO, POS tagging and Word Count per user of words in their account. Macaronic Text is also another way to practice only the important information")
718
- gr.HTML("""<hr> <p>For Transcripts to any video on youtube 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> | <a href="https://huggingface.co/spaces/vumichien/whisper-speaker-diarization">https://huggingface.co/spaces/vumichien/whisper-speaker-diarization</a>""")
719
- #gr.HTML("<p>If Space not loaded its because of offline devopment errors please message for edit</p> <hr>")
720
- with gr.Tab("Merged Subtitles"):
721
- gr.HTML("Step 1 - Word for Word Translation Creation in both Directions (Paste Google Translation here)")
722
- gr.Interface(fn=split_srt_file, inputs=["text", SRTLangOptions] , outputs=["text", "file", "text", "text"], description="SRT Contents to W4W Split SRT for Google Translate")
723
- gr.HTML("Step 2 - Pronounciation (Roman) to Subtitle Format --> GTranslate returns unformatted string")
724
- gr.Interface(fn=splittext, inputs="text", outputs="text", description="Text for w4w creation in G Translate")
725
- gr.HTML("Step 3 - Merge into one file")
726
- with gr.Row():
727
- RomanFile = gr.File(label="Paste Roman")
728
- W4WFile = gr.File(label="Paste Word 4 Word")
729
- FullMeanFile = gr.File(label="Paste Full Meaning")
730
- MacaronicFile = gr.File(label="Paste Macaronic Text")
731
- SentGramFormula = gr.File(label="Paste Sentence Grammar Formula Text")
732
- with gr.Row():
733
- MergeButton = gr.Button()
 
 
 
 
 
 
 
 
734
  with gr.Row():
735
- MergeOutput = gr.TextArea(label="Output")
736
- MergeButton.click(merge_lines, inputs=[RomanFile, W4WFile, FullMeanFile, MacaronicFile], outputs=[MergeOutput])
737
- with gr.Tab("Split video to segments"):
738
- gr.HTML("<a href='https://www.vlchelp.com/automated-screenshots-interval/'>How to make screenshot in vlc - https://www.vlchelp.com/automated-screenshots-interval/</a><br>")
739
- gr.Interface(VideotoSegment, inputs=[spvvideo_file_input, spvsubtitle_file_input], outputs=spvdownload_output)
740
- gr.Text("Text to Closed Class + Adjectives + Punctuation or Noun Verb + Punctuation ")
741
- with gr.Tab("Spelling + Chunks"):
742
- gr.Text("Merged Spelling Practice Placeholder - Spell multiple words simultaneously for simultaneous access")
743
- gr.HTML("<p> Spell multiple words simultaneously for simultaneous access </p> <p> Spelling Simplification - Use a dual language list? | Spelling is the end goal, you already know many letter orders called words so you need leverage them to remember random sequences")
744
- gr.Interface(fn=create_dictionary, inputs="text", outputs="text", title="Sort Text by first two letters")
745
- gr.Interface(fn=keep_nouns_verbs, inputs=["text"], outputs="text", description="Noun and Verbs only (Plus punctuation)")
746
- gr.Interface(fn=FrontRevSentChunk, inputs=[ChunkModeDrop, "checkbox", "text", langdest], outputs="text", description="Chunks creator")
747
- with gr.Tab("Thinking Practice"):
748
- with gr.Tab("Sentence to Format"):
749
- gr.Interface(fn=split_verbs_nouns , inputs="text", outputs=["text", "text", "text"], description="Comprehension reading and Sentence Format Creator")
750
- with gr.Tab("Knowledge Ideas - Notetaking"):
751
- gr.HTML("""<p>Good knowledge = ability to answer questions --> find Questions you cant answer and look for hidden answer within them </p>
752
- <p>My One Word Theory = We only use more words than needed when we have to or are bored --> Headings exist because title is not sufficient, subheadings exist because headings are not sufficient, Book Text exists because subheadings are not sufficient</p>
753
- <p>Big Picture = Expand the Heading and the subheadings and compare them to each other</p>
754
- <p>Application of Knowledge = App Version of the text (eg. Jupyter Notebooks) is what you create and learn first</p>
755
- """)
756
- gr.Interface(fn=TextCompFormat, inputs=["textarea", HTMLCompMode], outputs="text", description="Convert Text to HTML Dropdown or Links which you paste in any html file")
757
- gr.Interface(fn=create_collapsiblebutton, inputs=["textbox", "textbox", "textarea"], outputs="textarea", description="Button and Div HTML Generator, Generate the HTML for a button and the corresponding div element.")
758
- with gr.Tab("Automated Reading Assitant"):
759
- gr.HTML("Tree and Branches approach to learning = familiarity with keywords/headings/summaries before reading the whole text <hr> Productivity/Work revolves around repitition which can be found looking for plurals and grouping terms eg. Headings and Hyper/Hyponyms Analysis")
760
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
761
  lliface.queue().launch() #(inbrowser="true")
 
16
  from PIL import Image, ImageDraw, ImageFont
17
  import numpy as np
18
  from docx import Document
19
+ import textwrap
20
+ import pandas as pd
21
 
22
  #Uncomment these for Huggingface
23
  nltk.download('maxent_ne_chunker') #Chunker
 
327
  subtitle_text = ' | '.join(section_lines[2:])
328
  sub_split_line = nlp(subtitle_text)
329
  subtitle_textPOSversion = ""
330
+ subtitle_text = ""
331
 
332
  # Replace spaces in the subtitle text with " | "
333
  #subtitle_text = subtitle_text.replace(' ', ' | ')
 
438
  html = ""
439
  for line in lines:
440
  if line.startswith("http"):
441
+ html += f"<a href='{line}'> -- -- </a> | \n"
442
  else:
443
  html += line + "Not a link <br> \n"
444
  return html
445
 
446
+ HTMLCompMode = gr.Dropdown(choices=["Dropdown", "Links"], value="Links")
447
 
448
  def TextCompFormat(text, HTMLCompMode):
449
  FinalOutput = ""
 
628
  '''
629
 
630
  FinalOutput = FinalHTML + FinalCSS + FinalJS
631
+
632
+ HTMLDownloadTemp = f'UnknownVerbTrack.html'
633
+
634
+ with open(HTMLDownloadTemp, 'w') as f:
635
+ f.write(FinalOutput)
636
+
637
+ return FinalOutput, FinalOutput, HTMLDownloadTemp
638
 
639
  #Kathryn Lingel - Pyambic Pentameter Example - PyCon US
640
  #Basic Language Model Code
 
666
  return ' '.join(output) #New list into a string aka (hopefully) sentence
667
  # print(markov_generate("I am the egg man they are the egg men I am the wallrus goo goo g' joob"))
668
 
669
+ def chunk_srt_text(srt_text, chunk_size):
670
+ # Split the SRT text into chunks of the specified size
671
+ ChunkList = textwrap.wrap(srt_text, chunk_size)
672
+ dfFinalOutput = pd.DataFrame(ChunkList, columns = [f"Chunks - { len(ChunkList) }"])
673
+ return dfFinalOutput, ""
674
+
675
+ #-------------------------------------------------------------------------------------------------------------------------------
676
+ #Clean Merge
677
+
678
+ def split_into_fours(text):
679
+ lines = text.split('\n')
680
+ chunks = [lines[i:i+4] for i in range(0, len(lines), 4)]
681
+ return chunks
682
+
683
+ def NumberLineSort(listlen):
684
+ numbers = list(range(0, listlen)) # create a list of numbers 1 to 12
685
+ grouped_numbers = []
686
+ for i in range(4):
687
+ group = [numbers[j] for j in range(i, len(numbers), 4)]
688
+ grouped_numbers.append(group)
689
+ return grouped_numbers
690
+
691
+ def SRTLineSort(text):
692
+ chunks = split_into_fours(text)
693
+ NumberofBlocks = len(chunks) / 4
694
+ printnumber = NumberLineSort(len(chunks))
695
+ SRTLinenumber = []
696
+ SRTTiming = []
697
+ SRTContent = []
698
+ FinalOutput = ""
699
+
700
+ for i in range(0, 3):
701
+ for item in printnumber[i]:
702
+ if i == 0: SRTLinenumber.append(chunks[item][0])
703
+ if i == 1: SRTTiming.append(chunks[item][0])
704
+ if i == 2: SRTContent.append(chunks[item])
705
+
706
+ for i in range(0, int(NumberofBlocks)):
707
+ FinalOutput += SRTLinenumber[i] + "\n"
708
+ FinalOutput += SRTTiming[i] + "\n"
709
+ for i2 in range(0, 4):
710
+ FinalOutput += SRTContent[i][i2] + "\n"
711
+ FinalOutput += "\n"
712
+
713
+ return FinalOutput
714
+
715
+ #--------------------------------------------------------------------------------------------------------------------------------
716
+
717
+ RandomiseTextType = gr.Dropdown(choices=["Words", "Words5x", "Sentences", "Paragraph", "Page"], value="Words")
718
+
719
+ def RandomiseTextbyType(Text, Choice):
720
+ FinalOutput = ""
721
+ TempWords = []
722
+
723
+ if Choice == "Words" :
724
+ TempWords = Text.split()
725
+ FinalOutput = reading_randomize_words(TempWords)
726
+ if Choice == "Words5x" :
727
+ TempWords = Text.split()
728
+ FinalOutput = reading_randomize_words5x(TempWords)
729
+ if Choice == "Sentences" : FinalOutput = reading_randomize_words_in_sentence(Text)
730
+ if Choice == "Paragraph" : FinalOutput = reading_randomize_words_in_paragraph(Text)
731
+ if Choice == "Page" : FinalOutput = "Still under Construction"
732
+
733
+ return FinalOutput
734
+
735
+ def reading_randomize_words5x(word):
736
+ wordScram = ""
737
+ for item in word:
738
+ for i in range(5):
739
+ item = ''.join(random.sample(item, len(item)))
740
+ wordScram += " " + item
741
+ #print(item)
742
+ wordScram += "\n"
743
+ return wordScram
744
+
745
+ def reading_randomize_words(word):
746
+ wordScram = ""
747
+ for item in word:
748
+ item = ''.join(random.sample(item, len(item)))
749
+ wordScram += item + " "
750
+ return wordScram
751
+
752
+ def reading_randomize_words_in_sentence(text):
753
+ FinalOutput = ""
754
+ sentences = text.split(".")
755
+ for sentence in sentences:
756
+ words = sentence.split()
757
+ random.shuffle(words)
758
+ FinalOutput += ' '.join(words) + ". "
759
+ return FinalOutput
760
+
761
+ def reading_randomize_words_in_paragraph(paragraph):
762
+ sentences = paragraph.split(".")
763
+ random.shuffle(sentences)
764
+ return '. '.join(sentences)
765
+
766
+ #-------------------------------------------------------------------------------------------------------------------------------
767
+
768
+ def arrealtimetestidea(img):
769
+ return "Unfinished. The aim is to do realtime translation google but based on knowledge domains instead of language - Look at HF Models and spaces"
770
+
771
+ #------------------------------------------------------------------------------------------------------------------------------
772
+
773
 
774
  # Define the Gradio interface inputs and outputs for video split
775
  spvvideo_file_input = gr.File(label='Video File')
 
778
 
779
  Markovlength = gr.Number(value=30, label='Length of generation')
780
 
 
781
  groupinput_text = gr.Textbox(lines=2, label="Enter a list of words")
782
  groupoutput_text = gr.Textbox(label="Grouped words")
783
 
784
+ Translationchuncksize = gr.Number(value=4998)
785
+
786
+ with gr.Blocks() as lliface: #theme=gr.themes.Glass(primary_hue='green', secondary_hue='red', neutral_hue='blue', )
787
+ gr.HTML("<p>Timing Practice - Repitition: Run from it, Dread it, Repitition is inevitable - Thanos --> Repitition of reaction - Foreign in eyes/ears native in mind (For beginners) | Repitition is a multitask activity like driving must be subconcious process to show mastery </p>")
788
+ gr.HTML("""<a href='https://huggingface.co/spaces/sanchit-gandhi/whisper-jax'> -- Whisper JAX -- </a> | <a href="https://translate.google.com/?hl=en&tab=TT"> -- Google Translate -- </a> | <a href='https://huggingface.co/spaces/damo-vilab/modelscope-text-to-video-synthesis'> -- Modelscope Text to Video -- </a> | <a href='https://huggingface.co/spaces/stabilityai/stable-diffusion'> -- stable-diffusion 2 -- </a> | <a href='https://huggingface.co/spaces/stabilityai/stable-diffusion-1'> -- stable-diffusion 1 -- </a> | <a href='https://huggingface.co/spaces/kakaobrain/karlo'> -- karlo 1 -- </a> | <a href='https://huggingface.co/spaces/suno/bark'> -- Bark (TTS) -- </a> | <a href='https://chat.lmsys.org/'> -- Offline Text Model Demos --/</a> | <a href='https://huggingface.co/spaces/curt-park/segment-anything-with-clip'> -- SAM with Clip -- </a> | <a href='https://beta.elevenlabs.io/'> -- Eleven Labs -- </a> | """)
789
+ with gr.Row():
790
+ with gr.Column(scale=1):
791
+ with gr.Tab("Welcome"):
792
+ gr.HTML("""Gradio Version Below <iframe height="1200" style="width: 100%;" scrolling="no" title="Memorisation Aid" src="https://codepen.io/kwabs22/embed/GRXKQgj?default-tab=result&editable=true" frameborder="no" loading="lazy" allowtransparency="true" allowfullscreen="true">
793
+ See the Pen <a href="https://codepen.io/kwabs22/pen/GRXKQgj"> Memorisation Aid</a> by kwabs22 (<a href="https://codepen.io/kwabs22">@kwabs22</a>) on <a href="https://codepen.io">CodePen</a>. </iframe>""")
794
+ gr.Interface(fn=group_words, inputs=groupinput_text, outputs=groupoutput_text, description="Word Grouping and Rotation - Group a list of words into sets of 10 and rotate them every 60 seconds.") #.queue()
795
+ with gr.Tab("Navigation"):
796
+ gr.HTML("Picture Annotation <br> Chorus Focused Word List <br> Merged Subtitles <br> Repetitive Audio (TTS) <br> Word and Sentence Jumbling <br>")
797
+ with gr.Column(scale=3):
798
+ with gr.Tab("Beginner - Listen + Read"):
799
+ with gr.Tab("Reading - Caption images (SD/Dalle-E)"):
800
+ gr.HTML("""<a href="https://huggingface.co/spaces/pharma/CLIP-Interrogator"> --Huggingface CLIP-Interrogator Space-- </a><br> """)
801
+ gr.Interface(fn=removeTonalMarks, inputs="text", outputs="text", description="For text with characters use this function to remove any conflicting characters (if error below)")
802
+ gr.Interface(fn=add_text_to_image , inputs=["image", "text"], outputs="image", description="Create Annotated images (Can create using stable diffusion and use the prompt)")
803
+ gr.HTML("Use Shift Enter To put text on new lines if the text doesnt fit <hr>")
804
+ with gr.Tab("Listening - Songs - Chorus"):
805
+ gr.HTML("Anticipation of the item to remember is how you learn lyrics that is why songs are easy as if you heard it 10 times already your capacity to anticipate the words is great <br><br> This is where TTS helps as you are ignoring all words except the words just before the actual <hr>")
806
+ gr.HTML("<p>Fastest way to learn words = is to have your own sound reference --> probably why babies learn fast as they make random noise</p> <p>If you know the flow of the song you can remember the spelling easier</p><p>Essentially if the sounds are repeated or long notes they are easy to remember</p>")
807
+ gr.Interface(fn=AutoChorusInvestigator, inputs="text", outputs="text", description="Paste Full Lyrics to try find only chorus lines")
808
+ gr.Interface(fn=AutoChorusPerWordScheduler, inputs="text", outputs="text", description="Create order of repitition for tts practice")
809
+ gr.Interface(fn=TTSforListeningPractice, inputs=["text", TTSLangOptions], outputs="audio", description="Placeholder - paste chorus here and use TTS or make notes to save here")
810
+ #with gr.Tab("Transcribe - RASMUS Whisper"):
811
+ #gr.Interface.load("spaces/RASMUS/Whisper-youtube-crosslingual-subtitles", title="Subtitles")
812
+ with gr.Tab("Advanced - LingQ Addon Ideas"):
813
+ gr.HTML("<a href='https://www.lingq.com/en/'>Find Link Here --> https://www.lingq.com/en/</a>")
814
+ with gr.Tab("Visual - Multiline Custom Video Subtitles"):
815
+ gr.HTML("LingQ Companion Idea - i.e. Full Translation Read along, and eventually Videoplayer watch along like RAMUS whisper space <br><br>Extra functions needed - Persitent Sentence translation, UNWFWO, POS tagging and Word Count per user of words in their account. Macaronic Text is also another way to practice only the important information")
816
+ gr.HTML("""<hr> <p>For Transcripts to any video on youtube 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> | <a href="https://huggingface.co/spaces/vumichien/whisper-speaker-diarization">https://huggingface.co/spaces/vumichien/whisper-speaker-diarization</a>""")
817
+ #gr.HTML("<p>If Space not loaded its because of offline devopment errors please message for edit</p> <hr>")
818
+ with gr.Tab("Merged Subtitles"):
819
+ gr.HTML(""" Core Idea = Ability to follow one video from start to finish is more important than number of words (except for verbs) <hr>
820
+ Step 1 - Get foreign transcript - WHISPER (Need to download video though - booo) / Youtube / Youtube transcript api / SRT websites <br>
821
+ Step 2 - Get Translation of foreign transcript <br>
822
+ Step 3 - Word for Word Translation Creation in both Directions (Paste Google Translation here) <br>
823
+ """)
824
+ gr.Interface(fn=split_srt_file, inputs=["text", SRTLangOptions] , outputs=["text", "file", "text", "text"], description="SRT Contents to W4W Split SRT for Google Translate")
825
+ gr.Interface(fn=chunk_srt_text, inputs=['text', Translationchuncksize], outputs=['dataframe','text'], description='Assitant for google translate character limit - aka where to expect cuts in the text')
826
+ gr.HTML("Step 4 - Pronounciation (Roman) to Subtitle Format --> GTranslate returns unformatted string")
827
+ gr.Interface(fn=splittext, inputs="text", outputs="text", description="Text for w4w creation in G Translate")
828
+ gr.HTML("Step 5 - Merge into one file")
829
+ with gr.Row():
830
+ RomanFile = gr.File(label="Paste Roman")
831
+ W4WFile = gr.File(label="Paste Word 4 Word")
832
+ FullMeanFile = gr.File(label="Paste Full Meaning")
833
+ MacaronicFile = gr.File(label="Paste Macaronic Text")
834
+ SentGramFormula = gr.File(label="Paste Sentence Grammar Formula Text")
835
+ with gr.Row():
836
+ MergeButton = gr.Button(label='Merge the seperate files into one interpolated file (Line by line merge)')
837
+ with gr.Row():
838
+ MergeOutput = gr.TextArea(label="Output")
839
+ MergeButton.click(merge_lines, inputs=[RomanFile, W4WFile, FullMeanFile, MacaronicFile], outputs=[MergeOutput], )
840
+ with gr.Row():
841
+ gr.Text("Make sure there are 4 spaces after the last subtitle block (Otherwise its skipped)")
842
+ CleanedMergeButton = gr.Button(label='Create a Usable file for SRT')
843
+ with gr.Row():
844
+ CleanedMergeOutput = gr.TextArea(label="Output")
845
+ CleanedMergeButton.click(fn=SRTLineSort, inputs=[MergeOutput], outputs=[CleanedMergeOutput])
846
+ with gr.Tab("Split video to segments"):
847
+ gr.HTML("<a href='https://www.vlchelp.com/automated-screenshots-interval/'>How to make screenshot in vlc - https://www.vlchelp.com/automated-screenshots-interval/</a><br>")
848
+ gr.Interface(VideotoSegment, inputs=[spvvideo_file_input, spvsubtitle_file_input], outputs=spvdownload_output)
849
+ gr.Text("Text to Closed Class + Adjectives + Punctuation or Noun Verb + Punctuation ")
850
+ with gr.Tab("Audio - Only English thoughts as practice"):
851
+ gr.HTML("For Audio Most productive is real time recall of native (where your full reasoning ability will always be) <br><hr> Find Replace new lines of the foreign text with full stops or | to get per word translation")
852
+ gr.Interface(fn=TTSforListeningPractice, inputs=["text", TTSLangOptions2], outputs="audio", description="Paste only english words in foreign order and then keep removing the words from this to practice as effectively")
853
+ with gr.Tab("Transition is the end goal"):
854
  with gr.Row():
855
+ with gr.Column():
856
+ gr.Textbox("A word is a list of letter as a fact is a list of words. Both are in a specific order. What is most important is practice the order so randomiser is the tool")
857
+ gr.Interface(fn=RandomiseTextbyType, inputs=["text", RandomiseTextType], outputs="text", description="Randomise order within words, sentences, paragrahs")
858
+ with gr.Column():
859
+ #with gr.Tab("Collocations (Markov)"):
860
+ gr.HTML("Transition is the true nature of logic i.e. like some form of non-semantic embedding that is semantic?")
861
+ gr.Interface(fn=build_model, inputs="text", outputs=["text", "text"], description="Create Collocation Dictionary --> Google Kathryn Lingel - Pyambic Pentameter Example - PyCon US for more")
862
+ gr.Interface(fn=markov_generate, inputs=["text", Markovlength], outputs="text", description="Generate Text based on the collocations in the text")
863
+ with gr.Column():
864
+ #with gr.Tab("Spelling + Chunks"):
865
+ gr.Text("Merged Spelling Practice Placeholder - Spell multiple words simultaneously for simultaneous access")
866
+ gr.HTML("<p> Spell multiple words simultaneously for simultaneous access </p> <p> Spelling Simplification - Use a dual language list? | Spelling is the end goal, you already know many letter orders called words so you need leverage them to remember random sequences")
867
+ gr.Interface(fn=create_dictionary, inputs="text", outputs="text", title="Sort Text by first two letters")
868
+ gr.Interface(fn=keep_nouns_verbs, inputs=["text"], outputs="text", description="Noun and Verbs only (Plus punctuation)")
869
+ gr.Interface(fn=FrontRevSentChunk, inputs=[ChunkModeDrop, "checkbox", "text", langdest], outputs="text", description="Chunks creator")
870
+ with gr.Tab("Unknown Tracker"):
871
+ gr.HTML("Repitition of things you know is a waste of time when theres stuff you dont know <p> In Language the goal is bigger vocab --> Knowledge equivalent = question answer pairs but to get to those you need related information pairs</p> <p> Vocab = Glossary + all non text wall(lists, diagrams, etc.)</p>")
872
+ gr.Textbox("Placeholder for a function that creates a set list and can takes a list for known words and auto find replaces the stuff you know out of the content")
873
+ gr.Textbox("Place holder for a translate to english interface so that highlighting can still work as only english supported for now")
874
+ gr.Interface(fn=UnknownTrackTexttoApp, inputs="text", outputs=["html", "text", "file"], description="Use the text from here to create lists you use for the TTS section")
875
+ with gr.Tab("Unique word ID - use in Infranodus"):
876
+ gr.Interface(fn=unique_word_count, inputs="text", outputs="text", description="Wordcounter")
877
+ gr.Interface(fn=SepHypandSynExpansion, inputs="text", outputs=["text", "text"], description="Word suggestions - Analyse the unique words in infranodus")
878
+ gr.Interface(fn=WikiSearch, inputs="text", outputs="text", description="Unique word suggestions(wiki articles)")
879
+ with gr.Tab("Automating related information linking"):
880
+ gr.HTML("Questions - Tacking and suggesting questions to ask = new education")
881
+ with gr.Tab("Thinking Practice"):
882
+ with gr.Tab("Sentence to Format"):
883
+ gr.Interface(fn=split_verbs_nouns , inputs="text", outputs=["text", "text", "text"], description="Comprehension reading and Sentence Format Creator")
884
+ with gr.Tab("Knowledge Ideas - Notetaking"):
885
+ gr.HTML("""<p>Good knowledge = ability to answer questions --> find Questions you cant answer and look for hidden answer within them </p>
886
+ <p>My One Word Theory = We only use more words than needed when we have to or are bored --> Headings exist because title is not sufficient, subheadings exist because headings are not sufficient, Book Text exists because subheadings are not sufficient</p>
887
+ <p>Big Picture = Expand the Heading and the subheadings and compare them to each other</p>
888
+ <p>Application of Knowledge = App Version of the text (eg. Jupyter Notebooks) is what you create and learn first</p>
889
+ """)
890
+ gr.Interface(fn=TextCompFormat, inputs=["textarea", HTMLCompMode], outputs="text", description="Convert Text to HTML Dropdown or Links which you paste in any html file")
891
+ gr.Interface(fn=create_collapsiblebutton, inputs=["textbox", "textbox", "textarea"], outputs="textarea", description="Button and Div HTML Generator, Generate the HTML for a button and the corresponding div element.")
892
+ with gr.Tab("Automated Reading Assitant"):
893
+ gr.Textbox('Automating the Notetaking Tab either directly or using visual llm to use this interface efficiently')
894
+ gr.HTML("Tree and Branches approach to learning = familiarity with keywords/headings/summaries before reading the whole text <hr> Productivity/Work revolves around repitition which can be found looking for plurals and grouping terms eg. Headings and Hyper/Hyponyms Analysis")
895
+ with gr.Tab("AR"):
896
+ gr.Textbox("Alpha Test version = Real time Lablling of All things in view using SAM and Clip Interrogator and OpenCV on pydroid")
897
+ gr.HTML("<a href='https://huggingface.co/spaces/curt-park/segment-anything-with-clip'> -- SAM with Clip -- </a>")
898
+ gr.Interface(fn=arrealtimetestidea, inputs='image', outputs="text", description="Vision Assistant - see and execute")
899
+ gr.Interface(fn=arrealtimetestidea, inputs='webcam', outputs="text", description="Vision Assistant aka Free Observation llm judgement (GPT Vision API goes here when released). FPS is the difference between realtime app and static image")
900
+ with gr.Tab("Random Ideas"):
901
+ gr.HTML("""<p>Spaces Test - Still Undercontruction --> Next Milestone is Turning this interface handsfree | Knowledge is a Language but productive knowledge is find replace as well | LingQ is good option for per word state management</p> <p> Arrows app json creator for easy knowledge graphing and spacy POS graph? --> Questions? -->
902
+ <p> ChatGPT Turns Learning into a read only what you dont know ask only what you dont know feedback loop --> All you have to do is keep track of what prompts you have asked in the past</p> """)
903
+ gr.HTML("<p>Target 0: Mnemonics as title of images --> Comprehensible input <br> Target 1: Dual audio at word Level while using repitition to train random recall --> Word level Time <br> Target 2: Video --> Split by sentence --> each word repeated (60) + each phrase (10) + each sentence (10) --> TTS file for practice --> State Management/Known word Tracker <br>-----------------------<br> The trick is minimum one minute of focus on a new word --> Listening is hard because there are new word within seconds and you need repeated focus on each to learn </p> <p>Audio = best long form attention mechanism AS it is ANTICIPATION (Awareness of something before it happens like knowing song Lyrics) FOCUSED - Attention (Focused Repitition) + Exposure (Random Repitition) </p> <p>Listening is hard due to different word order and word combinations (collocations more important than single words)</p> <hr>")
904
+ gr.HTML("Predictable to identify the parts of picture being described --> The description moves in one direction from one side of the image to the other side is easiest <hr>")
905
+ gr.HTML("Image = instant comprehension like Stable Diffusion --> Audiovisual experience is the most optimal reading experience <br> Manga with summary descriptions for the chapters = Most aligned visual to audio experience")
906
+
907
  lliface.queue().launch() #(inbrowser="true")