hlydecker commited on
Commit
c0529d2
1 Parent(s): 8f66103

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -11
app.py CHANGED
@@ -183,22 +183,26 @@ def set_visible_false():
183
  def set_visible_true():
184
  return gr.update(visible=True)
185
 
186
-
187
-
188
- # Modify the 'iface' definition to use 'predict' as the function
189
  iface = gr.Interface(
190
  fn=predict, # Use 'predict' as the function
191
- inputs=[gr.inputs.Textbox(label="OpenAI GPT4 Key", type="password", placeholder="sk.."),
192
- gr.inputs.Textbox(label="System Message", default=""),
193
- gr.inputs.Textbox(label="API Result", type="text", default="")], # Add an input for API result
194
- outputs=[gr.outputs.Textbox(label="Summary"), gr.outputs.Textbox(label="API Response")], # Add an output for API response
 
 
 
195
  live=True,
196
  title="Padlet API Caller with cURL and LLM",
197
- description="Enter OpenAI GPT4 key, system message, and API result for summarization",
198
  )
199
 
200
- # Add event handlers to call 'create_post' when the "Create Post" button is clicked
201
- iface.inputs[3].submit(create_post, [board_id, gr.outputs.Textbox], [gr.outputs.Textbox])
202
- iface.inputs[3].click(create_post, [board_id, gr.outputs.Textbox], [gr.outputs.Textbox])
 
 
 
203
 
204
  iface.launch()
 
183
  def set_visible_true():
184
  return gr.update(visible=True)
185
 
186
+ # Define the Gradio interface
 
 
187
  iface = gr.Interface(
188
  fn=predict, # Use 'predict' as the function
189
+ inputs=[
190
+ gr.inputs.Textbox(label="OpenAI GPT4 Key", type="password", placeholder="sk.."),
191
+ gr.inputs.Textbox(label="System Message", default=""),
192
+ gr.inputs.Textbox(label="Input Board ID for api_call"),
193
+ gr.inputs.Textbox(label="Output Board ID for create_post"),
194
+ ],
195
+ outputs=gr.outputs.Textbox(label="Summary"),
196
  live=True,
197
  title="Padlet API Caller with cURL and LLM",
198
+ description="Enter OpenAI GPT4 key, system message, input board ID for api_call, and output board ID for create_post",
199
  )
200
 
201
+ # Add event handlers to call 'api_call' and 'create_post' when the "Generate Summary" and "Post Summary" buttons are clicked
202
+ iface.inputs[4].submit(api_call, [gr.inputs.Textbox])
203
+ iface.inputs[4].click(api_call, [gr.inputs.Textbox])
204
+
205
+ iface.inputs[5].submit(create_post, [gr.inputs.Textbox, gr.outputs.Textbox])
206
+ iface.inputs[5].click(create_post, [gr.inputs.Textbox, gr.outputs.Textbox])
207
 
208
  iface.launch()