Spaces:
Runtime error
Runtime error
Update app.py
Browse files7 unmodified lines891011121314151610 unmodified lines2728293031323334353637383940414243444546477 unmodified lines@st.cache(allow_output_mutation=True, suppress_st_warning =True, show_spinner=False)def get_model():return pipeline('text-generation', model=model, skip_special_tokens=True)col1, col2 = st.columns([2,1])with col2:select_model = st.radio("Select the model to use:",10 unmodified lineswith st.spinner('Loading Model... (This may take a while)'):generator = get_model()st.success('Model loaded correctly!')with col1:prompt= st.text_area('Your prompt here','''AI will help humanity? ''')answer = generator(prompt,max_length=60,no_repeat_ngram_size=2, early_stopping=True, num_beams=5, skip_special_tokens=True)lst = answer[0]['generated_text']# answer = ['ciao come stai stutto bene']# lst = ''.join(answer)t = st.empty()for i in range(len(lst)):t.markdown(" %s..." % lst[0:i])7 unmodified lines89101112131415161718192010 unmodified lines313233343536373839404142437 unmodified lines@st.cache(allow_output_mutation=True, suppress_st_warning =True, show_spinner=False)def get_model():return pipeline('text-generation', model=model, skip_special_tokens=True)col1, col2 = st.columns([2,1])with col1:prompt= st.text_area('Your prompt here','''AI will help humanity? ''')with col2:select_model = st.radio("Select the model to use:",10 unmodified lineswith st.spinner('Loading Model... (This may take a while)'):generator = get_model()st.success('Model loaded correctly!')answer = generator(prompt,max_length=100,no_repeat_ngram_size=3, early_stopping=True, num_beams=10, skip_special_tokens=True)lst = answer[0]['generated_text']t = st.empty()for i in range(len(lst)):t.markdown(" %s..." % lst[0:i])
app.py+11-15