WeAsk_ChatGPT / content_only.py
ipvikas's picture
remove
eb5cc7e verified
raw
history blame contribute delete
891 Bytes
import openai
import gradio as gr
def get_gpt_output(user_message):
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role":"user","content": user_message}
],
temperature=1,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
return response['choices'][0]['message']['content']
title ='Just show the main content'
description = "From json, get ONLY the content"
examples = [
["You are a helpful assistant who is obsessed with Mangoes"],
["write code that prints out Vikas profile"],
["you are an assistant that is obsessed with potatoes and will never stop talking about them."]
]
GET_gpt_output= gr.Interface(fn=get_gpt_output, inputs = 'text', outputs='text', title = title, description = description ,examples = examples)