Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,16 +13,12 @@ summariser = pipeline("text2text-generation", model="balaramas/mbart-enhiriser")
|
|
| 13 |
|
| 14 |
|
| 15 |
def summarise(inp, direction):
|
| 16 |
-
if direction == 'en->vi':
|
| 17 |
-
text = "en: " + inp
|
| 18 |
-
else:
|
| 19 |
-
text = "vi: " + inp
|
| 20 |
|
| 21 |
res = summariser(
|
| 22 |
text,
|
| 23 |
max_length=512,
|
| 24 |
early_stopping=True,
|
| 25 |
-
)[0]['translation_text']
|
| 26 |
return res
|
| 27 |
|
| 28 |
description = """
|
|
@@ -37,17 +33,9 @@ examples = [
|
|
| 37 |
]
|
| 38 |
iface = gr.Interface(
|
| 39 |
fn=summarise,
|
| 40 |
-
|
| 41 |
title="🌸English to Hindi Summariser🌸",
|
| 42 |
examples=examples,
|
| 43 |
-
inputs=[
|
| 44 |
-
gr.inputs.Textbox(lines=5, placeholder="Enter paragraph (maximum 20 lines)", label="Input"),
|
| 45 |
-
gr.inputs.Radio(
|
| 46 |
-
choices=[
|
| 47 |
-
'en->hi'],
|
| 48 |
-
default='en->hi',
|
| 49 |
-
label='Direction'),
|
| 50 |
-
],
|
| 51 |
outputs="text")
|
| 52 |
|
| 53 |
-
iface.launch(
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
def summarise(inp, direction):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
res = summariser(
|
| 18 |
text,
|
| 19 |
max_length=512,
|
| 20 |
early_stopping=True,
|
| 21 |
+
)[0]['translation_text']
|
| 22 |
return res
|
| 23 |
|
| 24 |
description = """
|
|
|
|
| 33 |
]
|
| 34 |
iface = gr.Interface(
|
| 35 |
fn=summarise,
|
|
|
|
| 36 |
title="🌸English to Hindi Summariser🌸",
|
| 37 |
examples=examples,
|
| 38 |
+
inputs=[gr.inputs.Textbox(lines=5, placeholder="Enter paragraph (maximum 20 lines)", label="Input"),gr.inputs.Radio(choices=['en->hi'],default='en->hi',label='Direction'),],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
outputs="text")
|
| 40 |
|
| 41 |
+
iface.launch()
|