File size: 649 Bytes
68e9609
857d94b
c5d56ba
68e9609
c5d56ba
2db5787
d3811c5
8e0ad92
857d94b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68e9609
2db5787
 
68e9609
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 gradio as gr
import openai
import os

openai.api_key = os.environ['openai']

#generates an AI description of your character
def describe(names):

	completion = openai.Completion.create(
		engine='text-davinci-003',
		prompt=names,
		max_tokens=210,
		temperature=0.97,
		frequency_penalty=0.2,
		presence_penalty= 0.25,
		top_p=1)

	result =completion.choices[0].text
	if not result :
		result = "Could you be any more boring?"

	return result
        
    

iface = gr.Interface(fn=describe, inputs=gr.Textbox(label="Your DND character",show_label=True), 
            outputs=gr.Textbox(label="The character",show_label=True))
iface.launch()