Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from inductor import BartInductor
|
|
4 |
inductor = BartInductor()
|
5 |
|
6 |
def bart(text):
|
7 |
-
results = inductor.generate(text)
|
8 |
#results=[('<mask> is the capital and largest city of <mask>.', 0.0075895977795922415), ('<mask> is the largest city in <mask>.', 0.005302619071099926), ('<mask> is the most populous state in <mask>.', 0.0036559513972044544), ('<mask> is the capital of <mask>.', 0.0028800265140167813), ('<mask> is a state in <mask>.', 0.002295685033583364), ('<mask> is a capital of <mask>.', 0.001348920570936385), ('<mask> has one of the highest rates of poverty in <mask>.', 0.0012284877234430835), ('<mask> is a major commercial and financial centre of <mask>.', 0.001225910195650215), ('<mask> was then a part of <mask>.', 0.0007620440367924856), ('<mask>, the capital of the country, is the largest city in <mask>.', 0.0006940517028590776)]
|
9 |
results = [(result[0], float(result[1]) * 100) for result in results]
|
10 |
results_dict = {result[0]: float(result[1]) for result in results}
|
|
|
4 |
inductor = BartInductor()
|
5 |
|
6 |
def bart(text):
|
7 |
+
results = inductor.generate(text, return_scores=True)
|
8 |
#results=[('<mask> is the capital and largest city of <mask>.', 0.0075895977795922415), ('<mask> is the largest city in <mask>.', 0.005302619071099926), ('<mask> is the most populous state in <mask>.', 0.0036559513972044544), ('<mask> is the capital of <mask>.', 0.0028800265140167813), ('<mask> is a state in <mask>.', 0.002295685033583364), ('<mask> is a capital of <mask>.', 0.001348920570936385), ('<mask> has one of the highest rates of poverty in <mask>.', 0.0012284877234430835), ('<mask> is a major commercial and financial centre of <mask>.', 0.001225910195650215), ('<mask> was then a part of <mask>.', 0.0007620440367924856), ('<mask>, the capital of the country, is the largest city in <mask>.', 0.0006940517028590776)]
|
9 |
results = [(result[0], float(result[1]) * 100) for result in results]
|
10 |
results_dict = {result[0]: float(result[1]) for result in results}
|