Spaces:
Sleeping
Sleeping
arieridwans
commited on
Commit
•
51a8c67
1
Parent(s):
9649ddd
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ user_prompt = st.text_area("Enter your prompt that can be song lyrics e.g. 'Yest
|
|
15 |
|
16 |
def run_inference():
|
17 |
instruct_prompt = "Instruct:You are a song writer and your main reference is The Beatles. Write a song lyrics by completing these words:"
|
18 |
-
output_prompt = "Output
|
19 |
input = inference_tokenizer(""" {0}{1}\n{2} """.format(instruct_prompt, user_prompt, output_prompt),
|
20 |
return_tensors="pt",
|
21 |
return_attention_mask=False,
|
@@ -23,10 +23,7 @@ def run_inference():
|
|
23 |
truncation=True)
|
24 |
result = inference_model.generate(**input, repetition_penalty=1.2, max_length=1024)
|
25 |
output = inference_tokenizer.batch_decode(result, skip_special_tokens=True)[0]
|
26 |
-
|
27 |
-
|
28 |
-
output_content = match.group(1).strip()
|
29 |
-
st.text("Generated Result:")
|
30 |
-
st.write(output_content)
|
31 |
|
32 |
st.button('Generate Result', on_click=run_inference)
|
|
|
15 |
|
16 |
def run_inference():
|
17 |
instruct_prompt = "Instruct:You are a song writer and your main reference is The Beatles. Write a song lyrics by completing these words:"
|
18 |
+
output_prompt = "Output:"
|
19 |
input = inference_tokenizer(""" {0}{1}\n{2} """.format(instruct_prompt, user_prompt, output_prompt),
|
20 |
return_tensors="pt",
|
21 |
return_attention_mask=False,
|
|
|
23 |
truncation=True)
|
24 |
result = inference_model.generate(**input, repetition_penalty=1.2, max_length=1024)
|
25 |
output = inference_tokenizer.batch_decode(result, skip_special_tokens=True)[0]
|
26 |
+
st.text("Generated Result:")
|
27 |
+
st.write(output)
|
|
|
|
|
|
|
28 |
|
29 |
st.button('Generate Result', on_click=run_inference)
|