File size: 963 Bytes
9781f5d
36c6254
aecdf77
9781f5d
64bfa0e
 
36c6254
64bfa0e
36c6254
9781f5d
36c6254
 
 
 
 
dfb15a5
36c6254
9781f5d
36c6254
 
 
 
 
 
 
9781f5d
36c6254
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
import openai
import gradio as gr
# openai.api_key = "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"

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)