Spaces:
Runtime error
Runtime error
Commit
•
190132f
1
Parent(s):
c52380d
Added a slider for input length
Browse files
app.py
CHANGED
@@ -13,11 +13,15 @@ summarizer = pipeline("summarization", model=MODEL_NAME, tokenizer=MODEL_NAME)
|
|
13 |
# tokenizer = AutoTokenizer.from_pretrained(PRETRAIN_MODEL_NAME)
|
14 |
|
15 |
# Define the function that will be used by the web app
|
16 |
-
def summarize_dialog(dialog):
|
17 |
# Summarize the dialog
|
18 |
-
summary = summarizer(dialog, max_length=
|
19 |
# Return the summary
|
20 |
return summary[0]['summary_text']
|
21 |
|
22 |
# Define the web app & launch
|
23 |
-
gr.Interface(fn=summarize_dialog,
|
|
|
|
|
|
|
|
|
|
13 |
# tokenizer = AutoTokenizer.from_pretrained(PRETRAIN_MODEL_NAME)
|
14 |
|
15 |
# Define the function that will be used by the web app
|
16 |
+
def summarize_dialog(dialog, max_length):
|
17 |
# Summarize the dialog
|
18 |
+
summary = summarizer(dialog, max_length=max_length, min_length=10, do_sample=False)
|
19 |
# Return the summary
|
20 |
return summary[0]['summary_text']
|
21 |
|
22 |
# Define the web app & launch
|
23 |
+
gr.Interface(fn=summarize_dialog,
|
24 |
+
inputs=["text",
|
25 |
+
gr.Slider(32, 256, value=128)
|
26 |
+
],
|
27 |
+
outputs="text").launch()
|