Spaces:
Runtime error
Runtime error
Commit
•
b5547a8
1
Parent(s):
2a57bee
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
|
4 |
-
|
5 |
|
6 |
def main(in_text):
|
7 |
print(in_text)
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
return ["Holy fuck","Holy fucking fuck","That body of yours is insane","hot"]
|
12 |
|
13 |
with gr.Blocks() as demo:
|
14 |
gr.Markdown("""# Summarization Engine!""")
|
@@ -18,15 +17,9 @@ with gr.Blocks() as demo:
|
|
18 |
label="Input Text",
|
19 |
lines=1,
|
20 |
)
|
21 |
-
output =
|
22 |
-
gr.Textbox(label="Hotness Score", default="Holy fucking fuck"),
|
23 |
-
gr.Textbox(label="Beauty Score", default="That body of yours is insane"),
|
24 |
-
gr.Textbox(label="Attractiveness Score", default="hot"),
|
25 |
-
]
|
26 |
b1 = gr.Button("Summarize!")
|
27 |
b1.click(main, inputs=[text1], outputs=output, api_name="s")
|
28 |
-
|
29 |
-
|
30 |
|
31 |
|
32 |
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
pipe = pipeline("summarization", model="google/bigbird-pegasus-large-arxiv")
|
5 |
|
6 |
def main(in_text):
|
7 |
print(in_text)
|
8 |
+
answer = pipe(in_text, min_length=5, max_length=round(len(in_text)/4))
|
9 |
+
print(answer)
|
10 |
+
return answer[0]["summary_text"]
|
|
|
11 |
|
12 |
with gr.Blocks() as demo:
|
13 |
gr.Markdown("""# Summarization Engine!""")
|
|
|
17 |
label="Input Text",
|
18 |
lines=1,
|
19 |
)
|
20 |
+
output = gr.Textbox(label="Output Text")
|
|
|
|
|
|
|
|
|
21 |
b1 = gr.Button("Summarize!")
|
22 |
b1.click(main, inputs=[text1], outputs=output, api_name="s")
|
|
|
|
|
23 |
|
24 |
|
25 |
|