Spaces:
Runtime error
Runtime error
Delete ChatGPT_app.py
Browse files- ChatGPT_app.py +0 -26
ChatGPT_app.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import openai
|
| 2 |
-
import gradio as gr
|
| 3 |
-
import time
|
| 4 |
-
def Question(Ask_Question):
|
| 5 |
-
# pass the generated text to audio
|
| 6 |
-
openai.api_key = "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"
|
| 7 |
-
# Set up the model and prompt
|
| 8 |
-
model_engine = "text-davinci-003"
|
| 9 |
-
#prompt = "who is alon musk?"
|
| 10 |
-
# Generate a response
|
| 11 |
-
completion = openai.Completion.create(
|
| 12 |
-
engine=model_engine,
|
| 13 |
-
prompt=Ask_Question,
|
| 14 |
-
max_tokens=1024,
|
| 15 |
-
n=1,
|
| 16 |
-
stop=None,
|
| 17 |
-
temperature=0.5,)
|
| 18 |
-
response = completion.choices[0].text
|
| 19 |
-
#out_result=resp['message']
|
| 20 |
-
return response
|
| 21 |
-
demo = gr.Interface(
|
| 22 |
-
title='OpenAI ChatGPT Application',
|
| 23 |
-
fn=Question,
|
| 24 |
-
inputs="text", outputs="text")
|
| 25 |
-
|
| 26 |
-
demo.launch(share=true)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|