Update app.py
Browse files
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 |
-
|
| 132 |
-
single_text = gr.Textbox(lines=7, label="Paste or type text here")
|
| 133 |
-
|
| 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,
|
|
|
|
| 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,
|