Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import gradio as gr
|
|
4 |
import nltk
|
5 |
from nltk.corpus import wordnet
|
6 |
import wikipedia
|
|
|
7 |
|
8 |
nltk.download('maxent_ne_chunker') #Chunker
|
9 |
nltk.download('stopwords') #Stop Words List (Mainly Roman Languages)
|
@@ -152,8 +153,6 @@ def WikiSearch(term):
|
|
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
|
@@ -195,40 +194,70 @@ def create_dictionary(word_list, word_dict = {}):
|
|
195 |
word_dict[key].append(word)
|
196 |
return word_dict
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
with gr.Blocks() as lliface:
|
199 |
with gr.Tab("Welcome "):
|
200 |
-
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>
|
|
|
|
|
|
|
201 |
gr.Interface(fn=unique_word_count, inputs="text", outputs="text", title="Wordcounter")
|
202 |
gr.Interface(fn=SepHypandSynExpansion, inputs="text", outputs=["text", "text"], title="Word suggestions")
|
203 |
-
gr.Interface(fn=WikiSearch, inputs="text", outputs="text", title="Unique word suggestions(wiki articles)")
|
204 |
-
with gr.Tab("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
gr.HTML("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")
|
206 |
with gr.Row():
|
207 |
-
gr.
|
208 |
-
gr.
|
209 |
-
gr.
|
210 |
-
gr.
|
211 |
with gr.Row():
|
212 |
-
gr.Button()
|
|
|
213 |
with gr.Row():
|
214 |
-
gr.TextArea(label="Output")
|
215 |
-
gr.Interface(fn=create_dictionary, inputs="text", outputs="text", title="Placeholder for transcript editor functions")
|
216 |
with gr.Tab("Transcribe - RASMUS Whisper"):
|
217 |
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>""")
|
218 |
gr.Interface.load("spaces/RASMUS/Whisper-youtube-crosslingual-subtitles", title="Subtitles")
|
219 |
-
with gr.Tab("Spelling and Chunks"):
|
220 |
-
with gr.Tab("Spelling Simplification"):
|
221 |
-
gr.Interface(fn=create_dictionary, inputs="text", outputs="text", title="Sort Text by first two letters")
|
222 |
-
with gr.Tab("Chunks"):
|
223 |
-
gr.Interface(fn=FrontRevSentChunk, inputs=[ChunkModeDrop, "checkbox", "text", langdest], outputs="text")
|
224 |
-
gr.Interface(fn=keep_nouns_verbs, inputs=["text"], outputs="text", title="Noun and Verbs only (Plus punctuation)")
|
225 |
with gr.Tab("Dictionary from text"):
|
226 |
gr.Interface(fn=create_dictionary, inputs="text", outputs="text", title="Two Letter Dictionary")
|
227 |
-
|
228 |
-
gr.HTML("""<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">
|
229 |
-
See the Pen <a href="https://codepen.io/kwabs22/pen/GRXKQgj">
|
230 |
-
Memorisation Aid</a> by kwabs22 (<a href="https://codepen.io/kwabs22">@kwabs22</a>)
|
231 |
-
on <a href="https://codepen.io">CodePen</a>.
|
232 |
-
</iframe>""")
|
233 |
|
234 |
lliface.launch()
|
|
|
4 |
import nltk
|
5 |
from nltk.corpus import wordnet
|
6 |
import wikipedia
|
7 |
+
import re
|
8 |
|
9 |
nltk.download('maxent_ne_chunker') #Chunker
|
10 |
nltk.download('stopwords') #Stop Words List (Mainly Roman Languages)
|
|
|
153 |
result = wikipedia.search(item, results=20)
|
154 |
return result
|
155 |
|
|
|
|
|
156 |
def find_string_positions(s, string):
|
157 |
positions = []
|
158 |
start = 0
|
|
|
194 |
word_dict[key].append(word)
|
195 |
return word_dict
|
196 |
|
197 |
+
def merge_lines(doc1, doc2, doc3, doc4):
|
198 |
+
docs = [doc1, doc2, doc3, doc4]
|
199 |
+
merged_lines = []
|
200 |
+
|
201 |
+
with open("merged_lines.txt", "w") as f:
|
202 |
+
for lines in zip(*[open(doc) for doc in docs]):
|
203 |
+
merged_line = "\n".join(line.strip() for line in lines)
|
204 |
+
f.write(merged_line + "\n")
|
205 |
+
merged_lines.append(merged_line)
|
206 |
+
|
207 |
+
return merged_lines
|
208 |
+
|
209 |
+
def TTSforListeningPractice(text):
|
210 |
+
return "not finished"
|
211 |
+
|
212 |
with gr.Blocks() as lliface:
|
213 |
with gr.Tab("Welcome "):
|
214 |
+
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>
|
215 |
+
<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>
|
216 |
+
<p> Vocab = Glossary + all non text wall(lists, diagrams, etc.)</p>
|
217 |
+
<p>https://huggingface.co/spaces/vumichien/whisper-speaker-diarization<br></p>""")
|
218 |
gr.Interface(fn=unique_word_count, inputs="text", outputs="text", title="Wordcounter")
|
219 |
gr.Interface(fn=SepHypandSynExpansion, inputs="text", outputs=["text", "text"], title="Word suggestions")
|
220 |
+
gr.Interface(fn=WikiSearch, inputs="text", outputs="text", title="Unique word suggestions(wiki articles)")
|
221 |
+
with gr.Tab("Spelling and Chunks"):
|
222 |
+
gr.HTML("Spelling is the end goal, you already know many letter orders called words so you need leverage them to remember random sequences")
|
223 |
+
with gr.Tab("Spelling Simplification - Use a dual language list"):
|
224 |
+
gr.Interface(fn=create_dictionary, inputs="text", outputs="text", title="Sort Text by first two letters")
|
225 |
+
with gr.Tab("Chunks"):
|
226 |
+
gr.Interface(fn=FrontRevSentChunk, inputs=[ChunkModeDrop, "checkbox", "text", langdest], outputs="text")
|
227 |
+
gr.Interface(fn=keep_nouns_verbs, inputs=["text"], outputs="text", title="Noun and Verbs only (Plus punctuation)")
|
228 |
+
with gr.Tab("Timing Practice - Repitition"):
|
229 |
+
gr.HTML("<p>Run from it, Dread it, Repitition is inevitable - Thanos</p>")
|
230 |
+
gr.HTML("""<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">
|
231 |
+
See the Pen <a href="https://codepen.io/kwabs22/pen/GRXKQgj">
|
232 |
+
Memorisation Aid</a> by kwabs22 (<a href="https://codepen.io/kwabs22">@kwabs22</a>)
|
233 |
+
on <a href="https://codepen.io">CodePen</a>.
|
234 |
+
</iframe>""")
|
235 |
+
with gr.Tab("Knowledge Ideas"):
|
236 |
+
gr.HTML("""<p>Good knowledge = ability to answer questions --> find Questions you cant answer and look for hidden answer within them </p>
|
237 |
+
<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>
|
238 |
+
<p>Big Picture = Expand the Heading and the subheadings and compare them to each other</p>
|
239 |
+
<p>Application of Knowledge = App Version of the text (eg. Jupyter Notebooks) is what you create and learn first</p>
|
240 |
+
""")
|
241 |
+
with gr.Tab("Beginner - Songs - Chorus"):
|
242 |
+
gr.HTML("Essentially if the sounds are repeated or long notes they are easy to remember")
|
243 |
+
gr.Interface(fn=TTSforListeningPractice, inputs="text", outputs="text", title="Placeholder - paste chorus here and use TTS")
|
244 |
+
with gr.Tab("Advanced - LingQ Addons ideas"):
|
245 |
gr.HTML("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")
|
246 |
with gr.Row():
|
247 |
+
RomanFile = gr.File(label="Paste Roman")
|
248 |
+
W4WFile = gr.File(label="Paste Word 4 Word")
|
249 |
+
FullMeanFile = gr.File(label="Paste Full Meaning")
|
250 |
+
MacaronicFile = gr.File(label="Paste Macaronic Text")
|
251 |
with gr.Row():
|
252 |
+
MergeButton = gr.Button()
|
253 |
+
MergeButton.click(merge_lines, inputs=["RomanFile", "W4WFile", "FullMeanFile", "MacaronicFile"], outputs=["MergeOutput"])
|
254 |
with gr.Row():
|
255 |
+
MergeOutput = gr.TextArea(label="Output")
|
|
|
256 |
with gr.Tab("Transcribe - RASMUS Whisper"):
|
257 |
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>""")
|
258 |
gr.Interface.load("spaces/RASMUS/Whisper-youtube-crosslingual-subtitles", title="Subtitles")
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
with gr.Tab("Dictionary from text"):
|
260 |
gr.Interface(fn=create_dictionary, inputs="text", outputs="text", title="Two Letter Dictionary")
|
261 |
+
|
|
|
|
|
|
|
|
|
|
|
262 |
|
263 |
lliface.launch()
|