Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,31 +6,43 @@ first = """informal english: corn fields are all across illinois, visible once y
|
|
6 |
|
7 |
@st.cache(allow_output_mutation=True)
|
8 |
def get_model():
|
9 |
-
print("hello")
|
10 |
#model = AutoModelForCausalLM.from_pretrained("BigSalmon/InformalToFormalLincoln21")
|
11 |
-
model = AutoModelForCausalLM.from_pretrained("BigSalmon/GPTNeo350MInformalToFormalLincoln2")
|
12 |
-
|
13 |
tokenizer = AutoTokenizer.from_pretrained("BigSalmon/Points2")
|
14 |
-
print("hello")
|
15 |
return model, tokenizer
|
16 |
|
17 |
model, tokenizer = get_model()
|
18 |
|
19 |
st.text('''How To Make Prompt:
|
20 |
-
|
21 |
-
|
|
|
22 |
Translated into the Style of Abraham Lincoln: at a time when nintendo has become inflexible, ( stubbornly bent on / firmly set on / unyielding in its insistence on / steadfastly transfixed by / uncompromising in its commitment to / rigidly decided on ) consoles that are tethered to a fixed iteration, sega diligently curates its legacy of classic video games on handheld devices.
|
23 |
informal english: garage band has made people who know nothing about music good at creating music.
|
|
|
|
|
|
|
24 |
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 ).
|
25 |
informal english: chrome extensions can make doing regular tasks much easier to get done.
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
informal english: national parks are a big part of the us culture.
|
30 |
-
Translated into the Style of Abraham Lincoln: the culture of the united states is ( inextricably ( bound up with / molded by / enriched by / enlivened by ) its ( serene / picturesque / pristine / breathtaking ) national parks ).
|
31 |
-
informal english: corn fields are all across illinois, visible once you leave chicago.
|
32 |
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.
|
33 |
-
informal english:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
temp = st.sidebar.slider("Temperature", 0.7, 1.5)
|
36 |
number_of_outputs = st.sidebar.slider("Number of Outputs", 5, 50)
|
@@ -65,9 +77,11 @@ def run_generate(text, bad_words):
|
|
65 |
with st.form(key='my_form'):
|
66 |
text = st.text_area(label='Enter sentence', value=first)
|
67 |
submit_button = st.form_submit_button(label='Submit')
|
|
|
68 |
if submit_button:
|
69 |
translated_text = run_generate(text, bad_words)
|
70 |
st.write(translated_text if translated_text else "No translation found")
|
|
|
71 |
with torch.no_grad():
|
72 |
text2 = str(text)
|
73 |
print(text2)
|
|
|
6 |
|
7 |
@st.cache(allow_output_mutation=True)
|
8 |
def get_model():
|
|
|
9 |
#model = AutoModelForCausalLM.from_pretrained("BigSalmon/InformalToFormalLincoln21")
|
10 |
+
#model = AutoModelForCausalLM.from_pretrained("BigSalmon/GPTNeo350MInformalToFormalLincoln2")
|
11 |
+
model = AutoModelForCausalLM.from_pretrained("BigSalmon/Points3")
|
12 |
tokenizer = AutoTokenizer.from_pretrained("BigSalmon/Points2")
|
|
|
13 |
return model, tokenizer
|
14 |
|
15 |
model, tokenizer = get_model()
|
16 |
|
17 |
st.text('''How To Make Prompt:
|
18 |
+
|
19 |
+
###
|
20 |
+
|
21 |
Translated into the Style of Abraham Lincoln: at a time when nintendo has become inflexible, ( stubbornly bent on / firmly set on / unyielding in its insistence on / steadfastly transfixed by / uncompromising in its commitment to / rigidly decided on ) consoles that are tethered to a fixed iteration, sega diligently curates its legacy of classic video games on handheld devices.
|
22 |
informal english: garage band has made people who know nothing about music good at creating music.
|
23 |
+
|
24 |
+
###
|
25 |
+
|
26 |
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 ).
|
27 |
informal english: chrome extensions can make doing regular tasks much easier to get done.
|
28 |
+
|
29 |
+
###
|
30 |
+
|
|
|
|
|
|
|
31 |
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.
|
32 |
+
informal english:
|
33 |
+
|
34 |
+
###
|
35 |
+
|
36 |
+
OR
|
37 |
+
|
38 |
+
###
|
39 |
+
- declining viewership facing the nba.
|
40 |
+
- does not have to be this way.
|
41 |
+
- in fact, many solutions exist.
|
42 |
+
- the four point line would surely draw in eyes.
|
43 |
+
text: failing to draw in the masses, the nba has ( fallen into / succumb to / bowed to ) disrepair. such does not have to be the case, however. in fact, a myriad of simple, relatively cheap ( solutions / interventions / enhancements ) could revive the league. the addition of the much-hyped four-point line would surely juice viewership.
|
44 |
+
###
|
45 |
+
-''')
|
46 |
|
47 |
temp = st.sidebar.slider("Temperature", 0.7, 1.5)
|
48 |
number_of_outputs = st.sidebar.slider("Number of Outputs", 5, 50)
|
|
|
77 |
with st.form(key='my_form'):
|
78 |
text = st.text_area(label='Enter sentence', value=first)
|
79 |
submit_button = st.form_submit_button(label='Submit')
|
80 |
+
submit_button2 = st.form_submit_button(label='Submit Log Probs')
|
81 |
if submit_button:
|
82 |
translated_text = run_generate(text, bad_words)
|
83 |
st.write(translated_text if translated_text else "No translation found")
|
84 |
+
if submit_button2:
|
85 |
with torch.no_grad():
|
86 |
text2 = str(text)
|
87 |
print(text2)
|