Pippoz commited on
Commit
378eb4f
1 Parent(s): df9431b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
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.beta_columns([2,1])
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
- with st.warning('Loading Model... (This may take a while)'):
 
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, max_length=60, no_repeat_ngram_size=2, early_stopping=True, num_beams=5)
 
 
 
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']