Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,22 +20,15 @@ def get_model():
|
|
| 20 |
|
| 21 |
model, tokenizer = get_model()
|
| 22 |
|
| 23 |
-
g = """
|
| 24 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
-
Translated into the Style of Abraham Lincoln: broadband is ( ( finally / at last / after years of delay ) arriving in remote locations / springing to life in far-flung outposts / inching into even the most backwater corners of the nation ) that will leap-frog them into the twenty-first century.
|
| 31 |
|
| 32 |
-
|
| 33 |
-
Translated into the Style of Abraham Lincoln: google translate ( imparts communicability to individuals whose native tongue differs / mitigates the trials of communication across linguistic barriers / hastens the bridging of semantic boundaries / mollifies the complexity of multilingual communication / avails itself to the internationalization of discussion / flexes its muscles to abet intercultural conversation / calms the tides of linguistic divergence ).
|
| 34 |
-
|
| 35 |
-
informal english: corn fields are all across illinois, visible once you leave chicago.
|
| 36 |
-
Translated into the Style of Abraham Lincoln: corn fields ( permeate illinois / span the state of illinois / ( occupy / persist in ) all corners of illinois / line the horizon of illinois / envelop the landscape of illinois ), manifesting themselves visibly as one ventures beyond chicago.
|
| 37 |
-
|
| 38 |
-
informal english:"""
|
| 39 |
|
| 40 |
with st.form(key='my_form'):
|
| 41 |
prompt = st.text_area(label='Enter sentence', value=g)
|
|
@@ -50,7 +43,7 @@ with st.form(key='my_form'):
|
|
| 50 |
logits, past_key_values = model(myinput, past_key_values = past_key_values, return_dict=False)
|
| 51 |
logits = logits[0,-1]
|
| 52 |
probabilities = torch.nn.functional.softmax(logits)
|
| 53 |
-
best_logits, best_indices = logits.topk(
|
| 54 |
best_words = [tokenizer.decode([idx.item()]) for idx in best_indices]
|
| 55 |
text.append(best_indices[0].item())
|
| 56 |
best_probabilities = probabilities[best_indices].tolist()
|
|
|
|
| 20 |
|
| 21 |
model, tokenizer = get_model()
|
| 22 |
|
| 23 |
+
g = """
|
| 24 |
+
***
|
| 25 |
|
| 26 |
+
original: sports teams are profitable for owners. [MASK], their valuations experience a dramatic uptick.
|
| 27 |
+
infill: sports teams are profitable for owners. ( accumulating vast sums / stockpiling treasure / realizing benefits / cashing in / registering robust financials / scoring on balance sheets ), their valuations experience a dramatic uptick.
|
| 28 |
|
| 29 |
+
***
|
|
|
|
| 30 |
|
| 31 |
+
original:"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
with st.form(key='my_form'):
|
| 34 |
prompt = st.text_area(label='Enter sentence', value=g)
|
|
|
|
| 43 |
logits, past_key_values = model(myinput, past_key_values = past_key_values, return_dict=False)
|
| 44 |
logits = logits[0,-1]
|
| 45 |
probabilities = torch.nn.functional.softmax(logits)
|
| 46 |
+
best_logits, best_indices = logits.topk(250)
|
| 47 |
best_words = [tokenizer.decode([idx.item()]) for idx in best_indices]
|
| 48 |
text.append(best_indices[0].item())
|
| 49 |
best_probabilities = probabilities[best_indices].tolist()
|