dk-crazydiv's picture
Update app.py
dcbf1c4
raw
history blame
1.31 kB
import streamlit as st
import cohere
import os
co = cohere.Client(os.getenv('COHERE_API_KEY'))
# Initialization
def generate_hashtags(input):
if len(input) == 0:
return None
response = co.generate(
model='large',
prompt="This program will take a sentence as input and reframe it with positive and growth mindset.\n\n--\nInput: I have a lot of work to do today.\nOutput: I have a lot of work to do today. It's better for me to make a list and break it down into smaller chunks and finish them off one by one.\n--\nInput: I am barely able to lift 10 pound weights.\nOutput: I should exercise more consistently and gradually increase my weight limit. I should also try eating healthy foods.\n--\nInput:{}\nOutput:".format(input),
max_tokens=100,
temperature=0.8,
k=0,
p=1,
frequency_penalty=0,
presence_penalty=0,
stop_sequences=["--"],
return_likelihoods='NONE')
output = response.generations[0].text
return output
st.title('Positive Reframing Generator')
st.write('''This is a simple **Streamlit** app that generates the input sentence with a positive spin to it''')
input = st.text_area('Enter your post title caption here', height=100)
if st.button('Reframe'):
output = generate_hashtags(input)
st.write(output)