impyadav
commited on
Commit
•
db53df3
1
Parent(s):
a897f98
Application file added
Browse files- app.py +26 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
3 |
+
|
4 |
+
tokenizer = AutoTokenizer.from_pretrained("impyadav/GPT2-FineTuned-Hinglish-Song-Generation")
|
5 |
+
|
6 |
+
model = AutoModelForCausalLM.from_pretrained("impyadav/GPT2-FineTuned-Hinglish-Song-Generation")
|
7 |
+
|
8 |
+
def get_song(line):
|
9 |
+
lyricist = pipeline(
|
10 |
+
"text-generation",
|
11 |
+
model=model,
|
12 |
+
tokenizer=tokenizer
|
13 |
+
)
|
14 |
+
return lyricist(line, max_length=200, num_return_sequences=5)
|
15 |
+
|
16 |
+
|
17 |
+
if __name__ == '__main__':
|
18 |
+
st.title('AI Lyricist')
|
19 |
+
st.write('Transformer Architecture : {}'.format('gpt-2'))
|
20 |
+
st.subheader("Input")
|
21 |
+
#st.write('Paste your query act here:')
|
22 |
+
user_input = st.text_area('', height=25) # height in pixel
|
23 |
+
# st.markdown('<style>red{color:red}</style>')
|
24 |
+
result = get_song(user_input)
|
25 |
+
if st.button('Run'):
|
26 |
+
st.write(result)
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
pytorch
|
3 |
+
streamlit
|