File size: 726 Bytes
4a9fd2e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36291f7
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


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)