winamnd commited on
Commit
5d70ee9
·
verified ·
1 Parent(s): 420c656

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -100,6 +100,7 @@ output_label = gr.Textbox(label="Spam Classification")
100
  save_button = gr.Button("Save to JSON")
101
  save_output = gr.Textbox(label="Save Status")
102
 
 
103
  demo = gr.Interface(
104
  fn=generate_ocr,
105
  inputs=[method_input, image_input],
@@ -109,7 +110,14 @@ demo = gr.Interface(
109
  theme="compact",
110
  )
111
 
112
- # Fix: Remove demo.get_component(save_button)
113
- save_button.click(save_to_json, inputs=[output_text, output_label], outputs=[save_output])
 
 
 
 
 
114
 
 
115
  demo.launch()
 
 
100
  save_button = gr.Button("Save to JSON")
101
  save_output = gr.Textbox(label="Save Status")
102
 
103
+ # Define the save button within the interface
104
  demo = gr.Interface(
105
  fn=generate_ocr,
106
  inputs=[method_input, image_input],
 
110
  theme="compact",
111
  )
112
 
113
+ # Create a separate interface for saving the results
114
+ save_interface = gr.Interface(
115
+ fn=save_to_json,
116
+ inputs=[output_text, output_label],
117
+ outputs=[save_output],
118
+ live=False
119
+ )
120
 
121
+ # Launch both interfaces together
122
  demo.launch()
123
+ save_interface.launch()