# -*- 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)