Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -41,23 +41,23 @@ def opendomain(text,wikipedia_language="en"):
|
|
41 |
return "Please write correct wikipedia article name OR question"
|
42 |
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
|
60 |
-
|
61 |
|
62 |
|
63 |
iface = gr.Interface(fn=opendomain, inputs=[gr.inputs.Textbox(lines=5)], outputs="text")
|
|
|
41 |
return "Please write correct wikipedia article name OR question"
|
42 |
|
43 |
|
44 |
+
final_out = re.sub(r'\=.+\=', '', text)
|
45 |
+
result = list(filter(lambda x: x != '', final_out.split('\n\n')))
|
46 |
+
answer = []
|
47 |
+
for i in range(6):
|
48 |
+
if len(result[i]) > 500:
|
49 |
+
summary_point=result[i].split(".")[0:3]
|
50 |
+
answer.append(summary_point)
|
51 |
|
52 |
+
final = ""
|
53 |
+
for value in answer:
|
54 |
+
joint_value = ".".join(value)
|
55 |
+
if final == "":
|
56 |
+
final += joint_value
|
57 |
+
else:
|
58 |
+
final = f"{final}.\n\n{joint_value}"
|
59 |
|
60 |
+
return final
|
61 |
|
62 |
|
63 |
iface = gr.Interface(fn=opendomain, inputs=[gr.inputs.Textbox(lines=5)], outputs="text")
|