import cohere | |
co = cohere.Client('NTZ1vJAJ6xFNk8ibiQjVh8E5CQLafLpKxjWJc5jp') | |
def write_post(topic): | |
response = co.generate( | |
model='command-xlarge-20221108', | |
prompt=f' \"{topic}\":', | |
max_tokens=300, | |
temperature=0.9, | |
k=0, | |
p=0.75, | |
frequency_penalty=0, | |
presence_penalty=0, | |
stop_sequences=[], | |
return_likelihoods='NONE') | |
return(response.generations[0].text) | |
import gradio as gr | |
with gr.Blocks() as demo: | |
gr.Markdown("# Artificial Literature Generator : By Hrishikesh") | |
#with gr.Row(): | |
inp = gr.Textbox(placeholder="Enter the text", label = "Topic") | |
btn = gr.Button("Generate your literature") | |
out = gr.Textbox() | |
btn.click(fn=write_post, inputs=inp, outputs=out) | |
demo.launch(debug = True) | |