Carlosjr5 commited on
Commit
7a4a318
1 Parent(s): 1ee2227

Add application file

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import os
2
  #pip3 install openai
3
- import openai
4
  #pip3 install gradio
5
  import gradio as gr
6
 
@@ -11,7 +11,7 @@ from data import OPENAI_API_KEY
11
  #if you have OpenAI API key as a string, enable the below
12
  OPEN_AI_KEY = OPENAI_API_KEY
13
 
14
- openai.api_key = OPEN_AI_KEY
15
 
16
  start_sequence = "\nAI:"
17
  restart_sequence = "\nHuman: "
@@ -20,7 +20,7 @@ prompt = "Feel free to ask any question to this bot, it can find you many soluti
20
 
21
  def openai_create(prompt):
22
 
23
- response = openai.Completion.create(
24
  model="text-davinci-003",
25
  prompt=prompt,
26
  temperature=0.9,
@@ -49,8 +49,7 @@ block = gr.Blocks()
49
 
50
 
51
  with block:
52
- gr.Markdown("""<h1><center>CarlosJR Smart Bot</center></h1>
53
- """)
54
  chatbot = gr.Chatbot()
55
  message = gr.Textbox(placeholder=prompt)
56
  state = gr.State()
 
1
  import os
2
  #pip3 install openai
3
+ import openai as oai
4
  #pip3 install gradio
5
  import gradio as gr
6
 
 
11
  #if you have OpenAI API key as a string, enable the below
12
  OPEN_AI_KEY = OPENAI_API_KEY
13
 
14
+ oai.api_key = OPEN_AI_KEY
15
 
16
  start_sequence = "\nAI:"
17
  restart_sequence = "\nHuman: "
 
20
 
21
  def openai_create(prompt):
22
 
23
+ response = oai.Completion.create(
24
  model="text-davinci-003",
25
  prompt=prompt,
26
  temperature=0.9,
 
49
 
50
 
51
  with block:
52
+ gr.Markdown("""<h1><center>CarlosJR Smart Bot</center></h1>""")
 
53
  chatbot = gr.Chatbot()
54
  message = gr.Textbox(placeholder=prompt)
55
  state = gr.State()