File size: 1,221 Bytes
19c5ed1
 
 
 
 
 
 
 
80bb86d
370faa6
19c5ed1
370faa6
 
19c5ed1
 
 
51700b7
19c5ed1
370faa6
19c5ed1
370faa6
19c5ed1
 
 
 
 
 
 
c93e145
19c5ed1
 
 
 
 
 
 
 
370faa6
19c5ed1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import streamlit as st
from streamlit_tags import st_tags, st_tags_sidebar
from keytotext import pipeline
from PIL import Image

############
## Main page
############

st.write("# Code for Keywords to Text")

st.markdown("***Idea is to build a model which will take keywords as inputs and generate information as outputs.***")
image = Image.open('1.png')
st.image(image)
        
st.sidebar.write("# Parameter Selection")
maxtags_sidebar = st.sidebar.slider('Number of tags allowed?', 1, 10, 1, key='ehikwegrjifbwreuk')
keywords = st_tags(
    label='# Enter Keywords:',
    text='Press enter to add more',
    value=['Summer'],
    suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'],
    maxtags=maxtags_sidebar,
    key="aljnf")

# Add selectbox in streamlit
option = st.sidebar.selectbox(
     'Which model would you like to be selected?',
     ('mrm8488/t5-base-finetuned-common_gen', 'k2t-base', 'k2t'))

#if st.sidebar.button('Load Model'):
#    nlp=pipeline(option)
#    st.sidebar.success("Load Successfully!")
nlp=pipeline(option)
st.sidebar.success("Load Successfully!")

st.write("## Results:")
if st.button('Generate Sentence'):
    out=nlp(keywords)
    st.success(out)