tonyliu404 commited on
Commit
930c3b6
·
verified ·
1 Parent(s): 4a664b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -291,8 +291,6 @@ def display_dishes_in_grid(dishes, cols=3):
291
  st.sidebar.write(dish.replace("_", " ").capitalize())
292
 
293
  def display_prediction_graph(class_names, confidences):
294
- theme_mode = st.get_option("theme.base")
295
- print("ThEME MODE IQEWOKWQPIJWQPIJEWQOPIJWQPIJEWQPIJEWQPJIEWQPWQEPEWQPOJPJQWEOPJW",theme_mode)
296
  #reversing them so graph displays highest predictions at the top
297
  confidences.reverse()
298
  class_names.reverse()
@@ -315,7 +313,7 @@ def display_prediction_graph(class_names, confidences):
315
  if width < min_width:
316
  width = min_width
317
  ax.text(width - 0.02, bar.get_y() + bar.get_height()/2, f'{original_width:.1f}%',
318
- va='center', ha='right', color='white' if theme_mode == "dark" else "black", fontweight='bold', fontsize=16)
319
 
320
  ax.set_xticklabels([]) #remove x label
321
 
@@ -323,13 +321,13 @@ def display_prediction_graph(class_names, confidences):
323
  max_label_width = 10
324
  labels = ax.get_yticklabels()
325
  wrapped_labels = [textwrap.fill(label.get_text(), width=max_label_width) for label in labels] # Wrap the labels if they exceed the max width
326
- ax.set_yticklabels(wrapped_labels, fontsize=16, color='white' if theme_mode == "dark" else "black")
327
 
328
  #no borders
329
  for spine in ax.spines.values():
330
  spine.set_visible(False)
331
 
332
- ax.set_title(class_names[-1], color='white' if theme_mode == "dark" else "black", fontsize=24, fontweight='bold', ha='left', x=0.5)
333
 
334
  st.pyplot(fig) # Display the plot
335
 
 
291
  st.sidebar.write(dish.replace("_", " ").capitalize())
292
 
293
  def display_prediction_graph(class_names, confidences):
 
 
294
  #reversing them so graph displays highest predictions at the top
295
  confidences.reverse()
296
  class_names.reverse()
 
313
  if width < min_width:
314
  width = min_width
315
  ax.text(width - 0.02, bar.get_y() + bar.get_height()/2, f'{original_width:.1f}%',
316
+ va='center', ha='right', color='white', fontweight='bold', fontsize=16)
317
 
318
  ax.set_xticklabels([]) #remove x label
319
 
 
321
  max_label_width = 10
322
  labels = ax.get_yticklabels()
323
  wrapped_labels = [textwrap.fill(label.get_text(), width=max_label_width) for label in labels] # Wrap the labels if they exceed the max width
324
+ ax.set_yticklabels(wrapped_labels, fontsize=16, color='white')
325
 
326
  #no borders
327
  for spine in ax.spines.values():
328
  spine.set_visible(False)
329
 
330
+ ax.set_title(class_names[-1], color='white', fontsize=24, fontweight='bold', ha='left', x=0.5)
331
 
332
  st.pyplot(fig) # Display the plot
333