ambrosfitz commited on
Commit
8b3a670
·
verified ·
1 Parent(s): 35e6a4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -12,7 +12,7 @@ client = OpenAI(
12
  def runpod_chat(question, history=None):
13
  # Explicitly initialize history if it's None
14
  if history is None:
15
- history = []
16
  history.append({"role": "user", "content": question})
17
 
18
  response_stream = client.chat.completions.create(
@@ -38,7 +38,7 @@ iface = gr.Interface(
38
  fn=runpod_chat,
39
  inputs=[
40
  gr.Textbox(label="Enter your question:"),
41
- gr.State(default=[]) # Set default state explicitly
42
  ],
43
  outputs=[
44
  gr.Textbox(label="Responses"),
 
12
  def runpod_chat(question, history=None):
13
  # Explicitly initialize history if it's None
14
  if history is None:
15
+ history = [] # Ensure history starts as an empty list if none is provided
16
  history.append({"role": "user", "content": question})
17
 
18
  response_stream = client.chat.completions.create(
 
38
  fn=runpod_chat,
39
  inputs=[
40
  gr.Textbox(label="Enter your question:"),
41
+ gr.State() # Remove default parameter
42
  ],
43
  outputs=[
44
  gr.Textbox(label="Responses"),