Spaces:
Runtime error
Runtime error
File size: 680 Bytes
66cfe90 230c79c 66cfe90 d82a394 66cfe90 4c0ec7f 66cfe90 e18fe7e 66cfe90 |
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 30 31 32 33 |
import gradio as gr
import openai
import os
def Question(Ask_Question):
# pass the generated text to audio
# openai.api_key = "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"
openai.api_key = os.environ.get('ApiKey')
# Set up the model and prompt
model_engine = "gpt-3.5-turbo"
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()
|