Spaces:
Running
Running
Commit
·
5bf95ef
1
Parent(s):
9cc63b5
Refactor rexplore_summarizer to return raw response and fix citation stripping in NLP summary
Browse files- app.py +2 -3
- nlp_processes.py +1 -1
app.py
CHANGED
@@ -4,7 +4,6 @@ import json
|
|
4 |
|
5 |
def rexplore_summarizer(url, title, id, citation, access_key):
|
6 |
response = json.loads(main(url, title, id, citation, access_key))
|
7 |
-
data = json.dumps(response, indent=4, ensure_ascii=False)
|
8 |
if response["mindmap_status"] != "success":
|
9 |
mindmap = "error"
|
10 |
else:
|
@@ -13,7 +12,7 @@ def rexplore_summarizer(url, title, id, citation, access_key):
|
|
13 |
summary = "error"
|
14 |
else:
|
15 |
summary = response["summary"]
|
16 |
-
return
|
17 |
|
18 |
def clear_everything(url, title, id, citation, access_key, raw_data, summary, mindmap):
|
19 |
return None, None, None, None, None, None
|
@@ -64,4 +63,4 @@ with gr.Blocks(theme=theme, title="ReXplore Summarizer", fill_height=True) as ap
|
|
64 |
)
|
65 |
clear_btn.click(clear_everything, inputs=[url, title, id, citation, raw_data, summary, mindmap, access_key], outputs=[url, id, raw_data, summary, mindmap, access_key], show_api=False)
|
66 |
|
67 |
-
app.queue(default_concurrency_limit=25).launch(show_api=True,
|
|
|
4 |
|
5 |
def rexplore_summarizer(url, title, id, citation, access_key):
|
6 |
response = json.loads(main(url, title, id, citation, access_key))
|
|
|
7 |
if response["mindmap_status"] != "success":
|
8 |
mindmap = "error"
|
9 |
else:
|
|
|
12 |
summary = "error"
|
13 |
else:
|
14 |
summary = response["summary"]
|
15 |
+
return response, summary, mindmap
|
16 |
|
17 |
def clear_everything(url, title, id, citation, access_key, raw_data, summary, mindmap):
|
18 |
return None, None, None, None, None, None
|
|
|
63 |
)
|
64 |
clear_btn.click(clear_everything, inputs=[url, title, id, citation, raw_data, summary, mindmap, access_key], outputs=[url, id, raw_data, summary, mindmap, access_key], show_api=False)
|
65 |
|
66 |
+
app.queue(default_concurrency_limit=25).launch(show_api=True, ssr_mode=False)
|
nlp_processes.py
CHANGED
@@ -147,7 +147,7 @@ def generate_nlp_summary_and_mindmap(temp_summary, title, citation):
|
|
147 |
if not fixed_citation:
|
148 |
response["citation"] = citation
|
149 |
else:
|
150 |
-
response["citation"] = fixed_citation.strip
|
151 |
def local_generate_nlp_summary():
|
152 |
nlp_summary = generate_nlp_summary(temp_summary)
|
153 |
if not nlp_summary:
|
|
|
147 |
if not fixed_citation:
|
148 |
response["citation"] = citation
|
149 |
else:
|
150 |
+
response["citation"] = fixed_citation.strip()
|
151 |
def local_generate_nlp_summary():
|
152 |
nlp_summary = generate_nlp_summary(temp_summary)
|
153 |
if not nlp_summary:
|