sadickam commited on
Commit
2095923
·
verified ·
1 Parent(s): dc5f90b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -128,10 +128,10 @@ def predict_sdg(text):
128
  return {top_prediction[0]: round(top_prediction[1], 3)}, fig
129
 
130
  # Define input and warning
131
- try:
132
- single_text = gr.Textbox(lines=7, label="Paste or type text here") if gr.Textbox(lines=7, label="Paste or type text here") != ''
133
- except:
134
- single_text = gr.Warning('This model need some text to return a prediction') if gr.Textbox(lines=7, label="Paste or type text here") == ''
135
 
136
  # Create Gradio interface for single text
137
  iface2 = gr.Interface(fn=predict_sdg,
 
128
  return {top_prediction[0]: round(top_prediction[1], 3)}, fig
129
 
130
  # Define input and warning
131
+ if gr.Textbox(lines=7, label="Paste or type text here") != '':
132
+ single_text = gr.Textbox(lines=7, label="Paste or type text here") != ''
133
+ else:
134
+ single_text = gr.Warning('This model need some text to return a prediction')
135
 
136
  # Create Gradio interface for single text
137
  iface2 = gr.Interface(fn=predict_sdg,