Spaces:
Runtime error
Runtime error
Update app.py
Browse filesЭто попытка оптимизации.
app.py
CHANGED
@@ -1,22 +1,23 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
import random
|
4 |
|
5 |
endings = ['ый', 'ий', 'ая', 'яя', 'ое', 'ее', 'ые', 'ие', 'ому', 'ему', 'ой', 'ей', 'ых', 'их', 'ым', 'им', 'ого', 'его', 'ую', 'юю', 'ого', 'его']
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
def gen(text):
|
8 |
a = text
|
9 |
count = random.randint(5, 15)
|
10 |
-
_dataset = open("dataset.txt", "r").readlines()
|
11 |
-
_a = list(set(a))
|
12 |
-
__dataset = {el: {"content": i} for el, i in enumerate(_dataset)}
|
13 |
-
dataset = ' '.join([i['content'].replace('\n', '') for i in __dataset.values() if any(ii in i['content'] for ii in _a)])
|
14 |
|
15 |
if len(dataset.strip()) == 0:
|
16 |
return random.choice(_dataset).strip()
|
17 |
|
18 |
words = {}
|
19 |
-
text =
|
20 |
random.shuffle(text)
|
21 |
|
22 |
for el, i in enumerate(text):
|
|
|
1 |
import gradio as gr
|
|
|
2 |
import random
|
3 |
|
4 |
endings = ['ый', 'ий', 'ая', 'яя', 'ое', 'ее', 'ые', 'ие', 'ому', 'ему', 'ой', 'ей', 'ых', 'их', 'ым', 'им', 'ого', 'его', 'ую', 'юю', 'ого', 'его']
|
5 |
|
6 |
+
_dataset = open("dataset.txt", "r").readlines()
|
7 |
+
_a = list(set(a))
|
8 |
+
__dataset = {el: {"content": i} for el, i in enumerate(_dataset)}
|
9 |
+
dataset = ' '.join([i['content'].replace('\n', '') for i in __dataset.values() if any(ii in i['content'] for ii in _a)])
|
10 |
+
dspl = dataset.split()
|
11 |
+
|
12 |
def gen(text):
|
13 |
a = text
|
14 |
count = random.randint(5, 15)
|
|
|
|
|
|
|
|
|
15 |
|
16 |
if len(dataset.strip()) == 0:
|
17 |
return random.choice(_dataset).strip()
|
18 |
|
19 |
words = {}
|
20 |
+
text = dspl
|
21 |
random.shuffle(text)
|
22 |
|
23 |
for el, i in enumerate(text):
|