Spaces:
Runtime error
Runtime error
Samuelblue
commited on
Commit
•
8b6816a
1
Parent(s):
206002f
Delete app.py
Browse files
app.py
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
!pip install openai
|
2 |
-
import gradio as gr
|
3 |
-
import openai
|
4 |
-
|
5 |
-
# Initialize the API key
|
6 |
-
openai.api_key = "YOUR_API_KEY"
|
7 |
-
|
8 |
-
def generate_text(prompt):
|
9 |
-
completions = openai.Completion.create(
|
10 |
-
engine="text-davinci-002",
|
11 |
-
prompt=prompt,
|
12 |
-
max_tokens=1024,
|
13 |
-
n=1,
|
14 |
-
stop=None,
|
15 |
-
temperature=0.5,
|
16 |
-
)
|
17 |
-
|
18 |
-
message = completions.choices[0].text
|
19 |
-
return message.strip()
|
20 |
-
|
21 |
-
inputs = gr.inputs.Textbox(lines=1, label="Enter your message:")
|
22 |
-
outputs = gr.outputs.Textbox(label="Response:")
|
23 |
-
|
24 |
-
interface = gr.Interface(
|
25 |
-
generate_text,
|
26 |
-
inputs,
|
27 |
-
outputs,
|
28 |
-
title="GPT-3 Chatbot",
|
29 |
-
description="A chatbot powered by GPT-3"
|
30 |
-
)
|
31 |
-
demo.launch()
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|