cicboy commited on
Commit
504e068
·
1 Parent(s): f2b03ec

update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -217,15 +217,19 @@ def generate_report(crypto_name, currency, days):
217
  crypto_inputs = {
218
  "cryptocurrency_selection": crypto_name.lower(),
219
  "currency_selection": currency.lower(),
220
- "days_selection": int(days),
221
  }
222
 
 
 
 
 
223
  result = crypto_analysis_crew.kickoff(inputs=crypto_inputs)
224
 
225
- if isinstance(result, dict) and "final_output" in result:
226
- return result["final_output"]
227
 
228
- return str(result)
 
229
 
230
  # ----------------------
231
  # GRADIO APP
@@ -260,8 +264,7 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as app:
260
  run_button.click(
261
  fn=generate_report,
262
  inputs=[crypto, currency, days],
263
- outputs=report_output,
264
- show_progress=True # this is fine; uses Gradio’s built-in indicator
265
  )
266
 
267
  if __name__ == "__main__":
 
217
  crypto_inputs = {
218
  "cryptocurrency_selection": crypto_name.lower(),
219
  "currency_selection": currency.lower(),
220
+ "days_selection": int(days)
221
  }
222
 
223
+ # Disable button at start
224
+ yield "", gr.update(interactive=False)
225
+
226
+ # Run workflow
227
  result = crypto_analysis_crew.kickoff(inputs=crypto_inputs)
228
 
229
+ final = result["final_output"] if isinstance(result, dict) and "final_output" in result else str(result)
 
230
 
231
+ # Return report + re-enable button
232
+ yield final, gr.update(interactive=True)
233
 
234
  # ----------------------
235
  # GRADIO APP
 
264
  run_button.click(
265
  fn=generate_report,
266
  inputs=[crypto, currency, days],
267
+ outputs=[report_output, run_button]
 
268
  )
269
 
270
  if __name__ == "__main__":