Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,23 +9,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
9 |
import tokenizers
|
10 |
#os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
11 |
random.seed(None)
|
12 |
-
first = """
|
13 |
-
informal english: garage band has made people who know nothing about music good at creating music.
|
14 |
-
Translated into the Style of Abraham Lincoln: garage band ( offers the uninitiated in music the ability to produce professional-quality compositions / catapults those for whom music is an uncharted art the ability the realize masterpieces / stimulates music novice's competency to yield sublime arrangements / begets individuals of rudimentary musical talent the proficiency to fashion elaborate suites ).
|
15 |
-
|
16 |
-
informal english: chrome extensions can make doing regular tasks much easier to get done.
|
17 |
-
Translated into the Style of Abraham Lincoln: chrome extensions ( yield the boon of time-saving convenience / ( expedite the ability to / unlock the means to more readily ) accomplish everyday tasks / turbocharges the velocity with which one can conduct their obligations ).
|
18 |
-
|
19 |
-
informal english: broadband is finally expanding to rural areas, a great development that will thrust them into modern life.
|
20 |
-
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.
|
21 |
-
|
22 |
-
informal english: google translate has made talking to people who do not share your language easier.
|
23 |
-
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 ).
|
24 |
-
|
25 |
-
informal english: corn fields are all across illinois, visible once you leave chicago.
|
26 |
-
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.
|
27 |
-
|
28 |
-
informal english:"""
|
29 |
suggested_text_list = [first]
|
30 |
@st.cache(hash_funcs={tokenizers.Tokenizer: id, tokenizers.AddedToken: id})
|
31 |
def load_model(model_name):
|
@@ -70,7 +54,7 @@ def extend(input_text, num_return_sequences, max_size=20, top_k=50, top_p=0.95):
|
|
70 |
parsed_text = "שגיאה"
|
71 |
return parsed_text
|
72 |
if __name__ == "__main__":
|
73 |
-
st.title("
|
74 |
pre_model_path = "BigSalmon/InformalToFormalLincoln14"
|
75 |
model, tokenizer = load_model(pre_model_path)
|
76 |
stop_token = "<|endoftext|>"
|
|
|
9 |
import tokenizers
|
10 |
#os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
11 |
random.seed(None)
|
12 |
+
first = """informal english: corn fields are all across illinois, visible once you leave chicago.\nTranslated 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.\ninformal english:"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
suggested_text_list = [first]
|
14 |
@st.cache(hash_funcs={tokenizers.Tokenizer: id, tokenizers.AddedToken: id})
|
15 |
def load_model(model_name):
|
|
|
54 |
parsed_text = "שגיאה"
|
55 |
return parsed_text
|
56 |
if __name__ == "__main__":
|
57 |
+
st.title("GPT2 Demo:")
|
58 |
pre_model_path = "BigSalmon/InformalToFormalLincoln14"
|
59 |
model, tokenizer = load_model(pre_model_path)
|
60 |
stop_token = "<|endoftext|>"
|