sadickam commited on
Commit
b5c1236
1 Parent(s): eb65f34

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +75 -81
app.py CHANGED
@@ -155,43 +155,6 @@ if submitted:
155
  df2['SubCatName'] = x_1
156
  df2['Likelihood'] = y_1
157
 
158
- c1, c2, c3 = st.columns([1.5, 0.5, 1])
159
-
160
- with c1:
161
- st.header("SubCatName")
162
- # plot graph of predictions
163
- fig = px.bar(df2, x="Likelihood", y="SubCatName", orientation="h")
164
-
165
- fig.update_layout(
166
- # barmode='stack',
167
- template='ggplot2',
168
- font=dict(
169
- family="Arial",
170
- size=14,
171
- color="black"
172
- ),
173
- autosize=False,
174
- width=500,
175
- height=1000,
176
- xaxis_title="Likelihood of SubCatName",
177
- yaxis_title="SubCatNames",
178
- # legend_title="Topics"
179
- )
180
-
181
- fig.update_xaxes(tickangle=0, tickfont=dict(family='Arial', color='black', size=14))
182
- fig.update_yaxes(tickangle=0, tickfont=dict(family='Arial', color='black', size=14))
183
- fig.update_annotations(font_size=14) # this changes y_axis, x_axis and subplot title font sizes
184
-
185
- # Plot
186
- st.plotly_chart(fig, use_container_width=False)
187
-
188
- with c3:
189
- st.header("")
190
- predicted_1 = st.metric("Predicted SubCatName", sorted_preds_1[0][0])
191
- Prediction_confidence_1 = st.metric("Prediction confidence", (str(round(sorted_preds_1[0][1]*100, 1))+"%"))
192
-
193
- #st.success("Great! SubCatName successfully predicted. ", icon="✅")
194
-
195
 
196
  # Second prediction
197
 
@@ -223,44 +186,6 @@ if submitted:
223
  df3['ExtraOver'] = x_2
224
  df3['Likelihood'] = y_2
225
 
226
- d1, d2, d3 = st.columns([1.5, 0.5, 1])
227
-
228
- with d1:
229
- st.header("ExtraOver")
230
- # plot graph of predictions
231
- fig = px.bar(df3, x="Likelihood", y="ExtraOver", orientation="h")
232
-
233
- fig.update_layout(
234
- # barmode='stack',
235
- template='ggplot2',
236
- font=dict(
237
- family="Arial",
238
- size=14,
239
- color="black"
240
- ),
241
- autosize=False,
242
- width=500,
243
- height=200,
244
- xaxis_title="Likelihood of ExtraOver",
245
- yaxis_title="ExtraOver",
246
- # legend_title="Topics"
247
- )
248
-
249
- fig.update_xaxes(tickangle=0, tickfont=dict(family='Arial', color='black', size=14))
250
- fig.update_yaxes(tickangle=0, tickfont=dict(family='Arial', color='black', size=14))
251
- fig.update_annotations(font_size=14) # this changes y_axis, x_axis and subplot title font sizes
252
-
253
- # Plot
254
- st.plotly_chart(fig, use_container_width=False)
255
-
256
- with d3:
257
- st.header("")
258
- predicted_2 = st.metric("Predicted ExtraOver", sorted_preds_2[0][0])
259
- Prediction_confidence_2 = st.metric("Prediction confidence", (str(round(sorted_preds_2[0][1]*100, 1))+"%"))
260
-
261
- #st.success("Great! ExtraOver successfully predicted. ", icon="✅")
262
-
263
-
264
 
265
  # Third prediction
266
 
@@ -292,9 +217,68 @@ if submitted:
292
  df4['Conversion_factor'] = x_3
293
  df4['Likelihood'] = y_3
294
 
295
- e1, e2, e3 = st.columns([1.5, 0.5, 1])
296
 
297
- with e1:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  st.header("Conversion_factor")
299
  # plot graph of predictions
300
  fig = px.bar(df4, x="Likelihood", y="Conversion_factor", orientation="h")
@@ -322,10 +306,20 @@ if submitted:
322
  # Plot
323
  st.plotly_chart(fig, use_container_width=False)
324
 
325
- with e3:
 
 
 
 
 
 
 
 
 
 
 
326
  st.header("")
327
  predicted_3 = st.metric("Predicted ExtraOver", sorted_preds_3[0][0])
328
- Prediction_confidence_3 = st.metric("Prediction confidence",
329
- (str(round(sorted_preds_3[0][1] * 100, 1)) + "%"))
330
 
331
- #st.success("Great! Conversion_factor successfully predicted. ", icon="✅")
 
155
  df2['SubCatName'] = x_1
156
  df2['Likelihood'] = y_1
157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
 
159
  # Second prediction
160
 
 
186
  df3['ExtraOver'] = x_2
187
  df3['Likelihood'] = y_2
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
  # Third prediction
191
 
 
217
  df4['Conversion_factor'] = x_3
218
  df4['Likelihood'] = y_3
219
 
 
220
 
221
+ st.empty()
222
+
223
+ tab1, tab2, tab3, tab4 = st.tabs(["Subcategory", "Extra Over", "Conversion Factor", "Summary"])
224
+
225
+ with tab1:
226
+ st.header("SubCatName")
227
+ # plot graph of predictions
228
+ fig = px.bar(df2, x="Likelihood", y="SubCatName", orientation="h")
229
+
230
+ fig.update_layout(
231
+ # barmode='stack',
232
+ template='ggplot2',
233
+ font=dict(
234
+ family="Arial",
235
+ size=14,
236
+ color="black"
237
+ ),
238
+ autosize=False,
239
+ width=500,
240
+ height=1000,
241
+ xaxis_title="Likelihood of SubCatName",
242
+ yaxis_title="SubCatNames",
243
+ # legend_title="Topics"
244
+ )
245
+
246
+ fig.update_xaxes(tickangle=0, tickfont=dict(family='Arial', color='black', size=14))
247
+ fig.update_yaxes(tickangle=0, tickfont=dict(family='Arial', color='black', size=14))
248
+ fig.update_annotations(font_size=14) # this changes y_axis, x_axis and subplot title font sizes
249
+
250
+ # Plot
251
+ st.plotly_chart(fig, use_container_width=False)
252
+
253
+ with tab2:
254
+ st.header("ExtraOver")
255
+ # plot graph of predictions
256
+ fig = px.bar(df3, x="Likelihood", y="ExtraOver", orientation="h")
257
+
258
+ fig.update_layout(
259
+ # barmode='stack',
260
+ template='ggplot2',
261
+ font=dict(
262
+ family="Arial",
263
+ size=14,
264
+ color="black"
265
+ ),
266
+ autosize=False,
267
+ width=500,
268
+ height=200,
269
+ xaxis_title="Likelihood of ExtraOver",
270
+ yaxis_title="ExtraOver",
271
+ # legend_title="Topics"
272
+ )
273
+
274
+ fig.update_xaxes(tickangle=0, tickfont=dict(family='Arial', color='black', size=14))
275
+ fig.update_yaxes(tickangle=0, tickfont=dict(family='Arial', color='black', size=14))
276
+ fig.update_annotations(font_size=14) # this changes y_axis, x_axis and subplot title font sizes
277
+
278
+ # Plot
279
+ st.plotly_chart(fig, use_container_width=False)
280
+
281
+ with tab3:
282
  st.header("Conversion_factor")
283
  # plot graph of predictions
284
  fig = px.bar(df4, x="Likelihood", y="Conversion_factor", orientation="h")
 
306
  # Plot
307
  st.plotly_chart(fig, use_container_width=False)
308
 
309
+ with tab4:
310
+ # subcatNames
311
+ st.header("")
312
+ predicted_1 = st.metric("Predicted SubCatName", sorted_preds_1[0][0])
313
+ Prediction_confidence_1 = st.metric("Prediction confidence", (str(round(sorted_preds_1[0][1] * 100, 1)) + "%"))
314
+
315
+ #ExtraOver
316
+ st.header("")
317
+ predicted_2 = st.metric("Predicted ExtraOver", sorted_preds_2[0][0])
318
+ Prediction_confidence_2 = st.metric("Prediction confidence", (str(round(sorted_preds_2[0][1] * 100, 1)) + "%"))
319
+
320
+ # Conversion_factor
321
  st.header("")
322
  predicted_3 = st.metric("Predicted ExtraOver", sorted_preds_3[0][0])
323
+ Prediction_confidence_3 = st.metric("Prediction confidence", (str(round(sorted_preds_3[0][1] * 100, 1)) + "%"))
 
324
 
325
+ st.success("Great! Predictions successfully predicted. ", icon="✅")