Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ st.markdown('## Text-generation OPT from Meta ')
|
|
9 |
def get_model():
|
10 |
return pipeline('text-generation', model=model, skip_special_tokens=True)
|
11 |
|
12 |
-
col1, col2 = st.
|
13 |
|
14 |
with col2:
|
15 |
select_model = st.radio(
|
@@ -23,16 +23,20 @@ with col2:
|
|
23 |
elif select_model == 'OPT-125m':
|
24 |
model = 'facebook/opt-125m'
|
25 |
|
26 |
-
|
|
|
27 |
generator = get_model()
|
28 |
st.success('Model loaded correctly!')
|
29 |
|
30 |
|
31 |
with col1:
|
32 |
prompt= st.text_area('Your prompt here',
|
33 |
-
'''AI will help humanity?''')
|
34 |
|
35 |
-
answer = generator(prompt,
|
|
|
|
|
|
|
36 |
lst = answer[0]['generated_text']
|
37 |
|
38 |
# answer = ['ciao come stai stutto bene']
|
|
|
9 |
def get_model():
|
10 |
return pipeline('text-generation', model=model, skip_special_tokens=True)
|
11 |
|
12 |
+
col1, col2 = st.columns([2,1])
|
13 |
|
14 |
with col2:
|
15 |
select_model = st.radio(
|
|
|
23 |
elif select_model == 'OPT-125m':
|
24 |
model = 'facebook/opt-125m'
|
25 |
|
26 |
+
if select_model:
|
27 |
+
st.warning('Loading Model... (This may take a while)'):
|
28 |
generator = get_model()
|
29 |
st.success('Model loaded correctly!')
|
30 |
|
31 |
|
32 |
with col1:
|
33 |
prompt= st.text_area('Your prompt here',
|
34 |
+
'''AI will help humanity? ''')
|
35 |
|
36 |
+
answer = generator(prompt,
|
37 |
+
max_length=60,
|
38 |
+
no_repeat_ngram_size=2, early_stopping=True, num_beams=5, , skip_special_tokens=True)
|
39 |
+
|
40 |
lst = answer[0]['generated_text']
|
41 |
|
42 |
# answer = ['ciao come stai stutto bene']
|