Spaces:
Sleeping
Sleeping
import gradio as gr | |
import openai | |
def Question(Ask_Question): | |
# pass the generated text to audio | |
openai.api_key = "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" | |
# Set up the model and prompt | |
model_engine = "text-davinci-003" | |
completion = openai.Completion.create( | |
engine=model_engine, | |
prompt=Ask_Question, | |
max_tokens=2048, | |
n=1, | |
top_p=1, | |
stop=None, | |
temperature=0.9,) | |
response = completion.choices[0].text | |
#out_result=resp['message'] | |
return response | |
demo = gr.Interface( | |
title='OpenAI ChatGPT Application', | |
fn=Question, | |
inputs="text", outputs="text") | |
demo.launch() | |