mgokg commited on
Commit
437d052
·
verified ·
1 Parent(s): 05803cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -53,22 +53,20 @@ def generate_with_history(input_text, history):
53
 
54
  # Building the Blocks interface
55
  with gr.Blocks() as demo:
56
- # State component to store the conversation across API calls
57
  history_state = gr.State([])
58
 
59
- # Hidden components to match your JS expectations
60
- input_box = gr.Textbox(visible=False)
61
- output_box = gr.Markdown(visible=False)
 
 
62
 
63
- # The API endpoint
64
- # Note: We include history_state in both inputs and outputs
65
- btn = gr.Button("Submit", visible=False)
66
  btn.click(
67
  fn=generate_with_history,
68
  inputs=[input_box, history_state],
69
  outputs=[output_box, history_state],
70
  api_name="generate"
71
  )
72
-
73
  if __name__ == "__main__":
74
  demo.launch()
 
53
 
54
  # Building the Blocks interface
55
  with gr.Blocks() as demo:
56
+ # State component (always invisible)
57
  history_state = gr.State([])
58
 
59
+ # Change visible=False to True (or remove it)
60
+ input_box = gr.Textbox(label="Input", visible=True)
61
+ output_box = gr.Markdown(label="Response", visible=True)
62
+
63
+ btn = gr.Button("Submit", visible=True)
64
 
 
 
 
65
  btn.click(
66
  fn=generate_with_history,
67
  inputs=[input_box, history_state],
68
  outputs=[output_box, history_state],
69
  api_name="generate"
70
  )
 
71
  if __name__ == "__main__":
72
  demo.launch()