Update app.py
Browse files
app.py
CHANGED
|
@@ -131,10 +131,12 @@ def predict_sdg(text):
|
|
| 131 |
return {top_prediction[0]: round(top_prediction[1], 3)}, fig
|
| 132 |
|
| 133 |
# Create Gradio interface for single text
|
| 134 |
-
iface2 = gr.Interface(fn=predict_sdg,
|
| 135 |
inputs=gr.Textbox(lines=7, label="Paste or type text here"),
|
| 136 |
outputs=[gr.Label(label="Top SDG Predicted", show_label=True), gr.Plot(label="Likelihood of all SDG", show_label=True)],
|
| 137 |
-
title="Single Text Prediction"
|
|
|
|
|
|
|
| 138 |
|
| 139 |
# UPLOAD CSV
|
| 140 |
# Define the prediction function
|
|
@@ -211,9 +213,13 @@ iface3 = gr.Interface(fn=predict_sdg_from_csv,
|
|
| 211 |
inputs= file_input,
|
| 212 |
outputs=[gr.Plot(label='Frequency of SDGs', show_label=True), gr.File(label='Download output CSV', show_label=True)],
|
| 213 |
title="Multi-text Prediction (CVS)",
|
| 214 |
-
description='NOTE
|
| 215 |
|
| 216 |
-
demo = gr.TabbedInterface([iface1, iface2, iface3],
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
|
| 218 |
# Run the interface
|
| 219 |
demo.launch()
|
|
|
|
| 131 |
return {top_prediction[0]: round(top_prediction[1], 3)}, fig
|
| 132 |
|
| 133 |
# Create Gradio interface for single text
|
| 134 |
+
iface2 = gr.Interface(fn=predict_sdg,
|
| 135 |
inputs=gr.Textbox(lines=7, label="Paste or type text here"),
|
| 136 |
outputs=[gr.Label(label="Top SDG Predicted", show_label=True), gr.Plot(label="Likelihood of all SDG", show_label=True)],
|
| 137 |
+
title="Single Text Prediction",
|
| 138 |
+
article="**Note:** The quality of model predictions may depend on the quality of information provided."
|
| 139 |
+
)
|
| 140 |
|
| 141 |
# UPLOAD CSV
|
| 142 |
# Define the prediction function
|
|
|
|
| 213 |
inputs= file_input,
|
| 214 |
outputs=[gr.Plot(label='Frequency of SDGs', show_label=True), gr.File(label='Download output CSV', show_label=True)],
|
| 215 |
title="Multi-text Prediction (CVS)",
|
| 216 |
+
description='**NOTE:** The column to be analysed must be titled ***text_inputs***')
|
| 217 |
|
| 218 |
+
demo = gr.TabbedInterface(interface_list = [iface1, iface2, iface3],
|
| 219 |
+
tab_names = ["General-App-Info", "Single-Text-Prediction", "Multi-Text-Prediction (CSV)"],
|
| 220 |
+
title = "Sustainble Development Goals (SDG) Text Classifier App",
|
| 221 |
+
theme = 'soft'
|
| 222 |
+
)
|
| 223 |
|
| 224 |
# Run the interface
|
| 225 |
demo.launch()
|