HaoMingSun commited on
Commit
d8ba4e6
·
verified ·
1 Parent(s): 59f2507

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  import os
4
 
5
  # Set your OpenAI API key
6
- client = OpenAI(api_key="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")
7
 
8
  greetings = ["hello", "hi", "hey", "greetings", "good morning", "good afternoon", "good evening"]
9
 
@@ -18,7 +18,7 @@ def chatbot(input, conversation_history=[]):
18
 
19
  # Define the structured interview messages
20
  messages = [
21
- {"role": "system", "content": "Your role is to answer the questions from the users friendly. If they ask weird questions or input things you do not understand, just say: 'Sorry, this question is beyond my understanding. Please try another one!"},
22
  ]
23
 
24
  # Extend the conversation history with the user's messages
@@ -46,4 +46,4 @@ outputs = [gr.components.Textbox(label="Reply"), gr.components.State()]
46
 
47
  gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="AI Chatbot",
48
  description="Ask anything you want",
49
- theme="Default").launch(share=True)
 
3
  import os
4
 
5
  # Set your OpenAI API key
6
+ client = OpenAI(api_key=os.environ["APITOKEN"])
7
 
8
  greetings = ["hello", "hi", "hey", "greetings", "good morning", "good afternoon", "good evening"]
9
 
 
18
 
19
  # Define the structured interview messages
20
  messages = [
21
+ {"role": "system", "content": "Your role is to answer the questions from the users friendly. If they ask weird questions or input things you do not understand, just say: 'Sorry, this question is beyond my understanding. Please try another one!"},
22
  ]
23
 
24
  # Extend the conversation history with the user's messages
 
46
 
47
  gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="AI Chatbot",
48
  description="Ask anything you want",
49
+ theme="Default").launch()