Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -46,10 +46,9 @@ def proc_nouns(sen_list):
|
|
46 |
print (e)
|
47 |
pass
|
48 |
print("done nouns")
|
49 |
-
|
50 |
return noun_list
|
51 |
|
52 |
-
def
|
53 |
text=str(text)
|
54 |
control_len=control_json['leng']-steps
|
55 |
control_char=list(control_json['control'])
|
@@ -66,8 +65,15 @@ def get_nouns(text,steps=1):
|
|
66 |
step_cont_box=[]
|
67 |
|
68 |
sen_list=get_sen_list(text)
|
69 |
-
|
70 |
key_cnt=len(sen_list)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
print(key_cnt)
|
72 |
#noun_cnt=len(noun_box)
|
73 |
#print(noun_cnt)
|
@@ -96,6 +102,8 @@ def get_nouns(text,steps=1):
|
|
96 |
#print (step_cont_box)
|
97 |
mod=0
|
98 |
pos=len(step_cont_box)-1
|
|
|
|
|
99 |
|
100 |
if go:
|
101 |
for i, ea in enumerate(sen_list):
|
@@ -119,7 +127,9 @@ def get_nouns(text,steps=1):
|
|
119 |
for iii,j in enumerate(step_cont_box):
|
120 |
print(j)
|
121 |
out_js = out_js+control_char[j]
|
122 |
-
sen_obj=
|
|
|
|
|
123 |
#json_out[out_js]={'nouns':ea}
|
124 |
json_out[out_js]=sen_obj
|
125 |
print ("#################")
|
@@ -174,7 +184,7 @@ with gr.Blocks() as app:
|
|
174 |
with gr.Column(scale=1):
|
175 |
nouns=gr.JSON(label="Nouns")
|
176 |
search_btn.click(find_query,[query,sen,nouns],[out_box,sen_box])
|
177 |
-
btn.click(
|
178 |
app.launch()
|
179 |
|
180 |
|
|
|
46 |
print (e)
|
47 |
pass
|
48 |
print("done nouns")
|
|
|
49 |
return noun_list
|
50 |
|
51 |
+
def sort_doc(text,steps=1):
|
52 |
text=str(text)
|
53 |
control_len=control_json['leng']-steps
|
54 |
control_char=list(control_json['control'])
|
|
|
65 |
step_cont_box=[]
|
66 |
|
67 |
sen_list=get_sen_list(text)
|
|
|
68 |
key_cnt=len(sen_list)
|
69 |
+
|
70 |
+
sen_obj_box=[]
|
71 |
+
for ee in sen_list:
|
72 |
+
sen_obj=proc_sen(sen_list,ee)
|
73 |
+
sen_obj_box.append(sen_obj)
|
74 |
+
|
75 |
+
sen_list=sen_obj_box
|
76 |
+
key_cnt=len(sen_obj_box)
|
77 |
print(key_cnt)
|
78 |
#noun_cnt=len(noun_box)
|
79 |
#print(noun_cnt)
|
|
|
102 |
#print (step_cont_box)
|
103 |
mod=0
|
104 |
pos=len(step_cont_box)-1
|
105 |
+
|
106 |
+
|
107 |
|
108 |
if go:
|
109 |
for i, ea in enumerate(sen_list):
|
|
|
127 |
for iii,j in enumerate(step_cont_box):
|
128 |
print(j)
|
129 |
out_js = out_js+control_char[j]
|
130 |
+
sen_obj=sen_obj_box[i]
|
131 |
+
#sen_obj=proc_sen(sen_list,i)
|
132 |
+
|
133 |
#json_out[out_js]={'nouns':ea}
|
134 |
json_out[out_js]=sen_obj
|
135 |
print ("#################")
|
|
|
184 |
with gr.Column(scale=1):
|
185 |
nouns=gr.JSON(label="Nouns")
|
186 |
search_btn.click(find_query,[query,sen,nouns],[out_box,sen_box])
|
187 |
+
btn.click(sort_doc,[inp],[sen,nouns])
|
188 |
app.launch()
|
189 |
|
190 |
|