Spaces:
Running
Running
Commit
·
3c576d2
1
Parent(s):
cc7374e
Increase concurrency limit for summarizer and remove print statements from summary generation functions
Browse files- app.py +2 -2
- math_summarizer.py +0 -4
- nlp_summarizer.py +0 -3
app.py
CHANGED
@@ -43,7 +43,7 @@ with gr.Blocks(theme=theme, title="ReXplore Summarizer", fill_height=True) as ap
|
|
43 |
rexplore_summarizer,
|
44 |
inputs=[text_corpus],
|
45 |
outputs=[raw_data, summary, mindmap],
|
46 |
-
concurrency_limit=
|
47 |
scroll_to_output=True,
|
48 |
show_api=True,
|
49 |
api_name="rexplore_summarizer",
|
@@ -51,4 +51,4 @@ with gr.Blocks(theme=theme, title="ReXplore Summarizer", fill_height=True) as ap
|
|
51 |
)
|
52 |
clear_btn.click(clear_everything, inputs=[text_corpus, raw_data, summary, mindmap], outputs=[text_corpus, raw_data, summary, mindmap], show_api=False)
|
53 |
|
54 |
-
app.queue(default_concurrency_limit=
|
|
|
43 |
rexplore_summarizer,
|
44 |
inputs=[text_corpus],
|
45 |
outputs=[raw_data, summary, mindmap],
|
46 |
+
concurrency_limit=25,
|
47 |
scroll_to_output=True,
|
48 |
show_api=True,
|
49 |
api_name="rexplore_summarizer",
|
|
|
51 |
)
|
52 |
clear_btn.click(clear_everything, inputs=[text_corpus, raw_data, summary, mindmap], outputs=[text_corpus, raw_data, summary, mindmap], show_api=False)
|
53 |
|
54 |
+
app.queue(default_concurrency_limit=25).launch(show_api=True)
|
math_summarizer.py
CHANGED
@@ -2,7 +2,6 @@ from gradio_client import Client
|
|
2 |
import threading
|
3 |
|
4 |
def generate_textrank_summary(research_paper_text):
|
5 |
-
print("Generating TextRank summary")
|
6 |
client = Client("raannakasturi/TextRankSummarizer")
|
7 |
summary = client.predict(
|
8 |
text_corpus=research_paper_text,
|
@@ -11,7 +10,6 @@ def generate_textrank_summary(research_paper_text):
|
|
11 |
return summary
|
12 |
|
13 |
def generate_luhn_summary(research_paper_text):
|
14 |
-
print("Generating Luhn summary")
|
15 |
client = Client("raannakasturi/LuhnSummarizer")
|
16 |
summary = client.predict(
|
17 |
text_corpus=research_paper_text,
|
@@ -32,7 +30,6 @@ def sanitize_text(input_string):
|
|
32 |
raise
|
33 |
|
34 |
def generate_math_summary(research_paper_text):
|
35 |
-
print("Generating math summary")
|
36 |
sanitized_text = sanitize_text(research_paper_text)
|
37 |
try:
|
38 |
textrank_summary = luhn_summary = lsa_summary = lexrank_summary = None
|
@@ -50,7 +47,6 @@ def generate_math_summary(research_paper_text):
|
|
50 |
for thread in threads:
|
51 |
thread.join()
|
52 |
math_summary = textrank_summary.replace("\n", "") + luhn_summary.replace("\n", "")
|
53 |
-
print("Math summary generated")
|
54 |
return math_summary
|
55 |
except Exception as e:
|
56 |
print(e)
|
|
|
2 |
import threading
|
3 |
|
4 |
def generate_textrank_summary(research_paper_text):
|
|
|
5 |
client = Client("raannakasturi/TextRankSummarizer")
|
6 |
summary = client.predict(
|
7 |
text_corpus=research_paper_text,
|
|
|
10 |
return summary
|
11 |
|
12 |
def generate_luhn_summary(research_paper_text):
|
|
|
13 |
client = Client("raannakasturi/LuhnSummarizer")
|
14 |
summary = client.predict(
|
15 |
text_corpus=research_paper_text,
|
|
|
30 |
raise
|
31 |
|
32 |
def generate_math_summary(research_paper_text):
|
|
|
33 |
sanitized_text = sanitize_text(research_paper_text)
|
34 |
try:
|
35 |
textrank_summary = luhn_summary = lsa_summary = lexrank_summary = None
|
|
|
47 |
for thread in threads:
|
48 |
thread.join()
|
49 |
math_summary = textrank_summary.replace("\n", "") + luhn_summary.replace("\n", "")
|
|
|
50 |
return math_summary
|
51 |
except Exception as e:
|
52 |
print(e)
|
nlp_summarizer.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import threading
|
2 |
|
3 |
def generate_nlp_summary(client, temp_summary):
|
4 |
-
print("Generating NLP Summary")
|
5 |
try:
|
6 |
completion = client.chat.completions.create(
|
7 |
model="hf:meta-llama/Meta-Llama-3.1-405B-Instruct",
|
@@ -15,7 +14,6 @@ def generate_nlp_summary(client, temp_summary):
|
|
15 |
return False
|
16 |
|
17 |
def generate_nlp_mindmap(client, temp_summary):
|
18 |
-
print("Generating NLP Mindmap")
|
19 |
try:
|
20 |
completion = client.chat.completions.create(
|
21 |
model="hf:meta-llama/Meta-Llama-3.1-405B-Instruct",
|
@@ -53,5 +51,4 @@ def generate_nlp_summary_and_mindmap(client, temp_summary):
|
|
53 |
thread.start()
|
54 |
for thread in threads:
|
55 |
thread.join()
|
56 |
-
print("NLP Summary and Mindmap generated")
|
57 |
return response
|
|
|
1 |
import threading
|
2 |
|
3 |
def generate_nlp_summary(client, temp_summary):
|
|
|
4 |
try:
|
5 |
completion = client.chat.completions.create(
|
6 |
model="hf:meta-llama/Meta-Llama-3.1-405B-Instruct",
|
|
|
14 |
return False
|
15 |
|
16 |
def generate_nlp_mindmap(client, temp_summary):
|
|
|
17 |
try:
|
18 |
completion = client.chat.completions.create(
|
19 |
model="hf:meta-llama/Meta-Llama-3.1-405B-Instruct",
|
|
|
51 |
thread.start()
|
52 |
for thread in threads:
|
53 |
thread.join()
|
|
|
54 |
return response
|