File size: 972 Bytes
4a9fd2e |
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 42 43 44 |
# -*- coding: utf-8 -*-
"""cohereblogpost.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1ayh0Wdn_olBVoK3oviOQnBx93AAS2g-M
"""
!pip install requests gradio -q
!pip install cohere -q
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 🚀")
out = gr.Textbox()
btn.click(fn=write_post, inputs=inp, outputs=out)
demo.launch(debug = True)
|