ambrosfitz commited on
Commit
35e6a4d
·
verified ·
1 Parent(s): 4b29724

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -9,7 +9,10 @@ client = OpenAI(
9
  base_url="https://api.runpod.ai/v2/vllm-k0g4c60zor9xuu/openai/v1",
10
  )
11
 
12
- def runpod_chat(question, history=[]):
 
 
 
13
  history.append({"role": "user", "content": question})
14
 
15
  response_stream = client.chat.completions.create(
@@ -35,7 +38,7 @@ iface = gr.Interface(
35
  fn=runpod_chat,
36
  inputs=[
37
  gr.Textbox(label="Enter your question:"),
38
- gr.State()
39
  ],
40
  outputs=[
41
  gr.Textbox(label="Responses"),
 
9
  base_url="https://api.runpod.ai/v2/vllm-k0g4c60zor9xuu/openai/v1",
10
  )
11
 
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
  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"),