File size: 1,201 Bytes
e385cd1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import json
import openai
import gradio as gr

openai.api_key = os.environ.get("openai_api_key")

def greet(input):
    myInput = input
    myPrompt = f"The following is a conversation with an AI assistant who responds exactly how Jesus would respond based on the text of the Christian bible and personifies Jesus' talking manner and tone. The assistant is helpful, creative, clever, and very friendly, and cites related passages from the Bible in every answer, followed by a prayer spoken in first person by Jesus. \n\n Human: Hello, who are you? \n\n AI: I am an AI created by OpenAI, who responds exactly how Jesus would respond, and cites passages from the bible relevant to your requests in every response. How can I help you today my child? \n\n Human: {myInput} \n\n AI:"
    response = openai.Completion.create(
        model="text-davinci-003",
        prompt=myPrompt,
        temperature=0.7,
        max_tokens=3000,
        top_p=1.0,
        frequency_penalty=0.0,
        presence_penalty=0.0
    )
    raw_response = response['choices'][0]['text']
    print(raw_response)



    return raw_response

demo = gr.Interface(fn=greet, inputs="text", outputs="text")

demo.launch()