Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,26 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
def complete_with_gpt(text):
|
7 |
-
# Use the last 50 characters of the text as context
|
8 |
-
return text[:-50] + api(text[-50:])
|
9 |
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
with gr.Blocks() as demo:
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
|
18 |
if __name__ == "__main__":
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
pipe = pipeline("summarization", model="Gabriel/bart-base-cnn-xsum-swe")
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
def main(in_text):
|
7 |
+
print(in_text)
|
8 |
+
answer = pipe(in_text, num_beams=5 ,min_length=5, max_length=20)
|
9 |
+
print(answer)
|
10 |
+
return answer[0]["summary_text"]
|
11 |
|
12 |
with gr.Blocks() as demo:
|
13 |
+
gr.Markdown("""# Summarization Engine!""")
|
14 |
+
with gr.Row():
|
15 |
+
with gr.Column():
|
16 |
+
text1 = gr.Textbox(
|
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)
|
23 |
+
gr.Markdown("""#### Created by Gabriel""")
|
24 |
|
25 |
|
26 |
if __name__ == "__main__":
|