tonyliu404 commited on
Commit
4236bdd
·
verified ·
1 Parent(s): 80ba866

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -10
app.py CHANGED
@@ -453,25 +453,18 @@ if recipe_submit and uploaded_image:
453
  ax.set_xticklabels([]) #remove x label
454
 
455
 
456
- # ax.tick_params(axis='y', colors='white', labelsize=16)
457
 
458
- # Define the maximum width (in terms of number of characters)
459
  max_label_width = 10
460
-
461
- # Get current tick labels
462
  labels = ax.get_yticklabels()
463
-
464
- # Wrap the labels if they exceed the max width
465
- wrapped_labels = [textwrap.fill(label.get_text(), width=max_label_width) for label in labels]
466
-
467
- # Set the wrapped labels back to the y-ticks
468
  ax.set_yticklabels(wrapped_labels, fontsize=16, color='white')
469
 
470
  #no borders
471
  for spine in ax.spines.values():
472
  spine.set_visible(False)
473
 
474
- ax.set_title(class_names[-1], color='white', fontsize=16, fontweight='bold', ha='center')
475
 
476
  st.pyplot(fig) # Display the plot
477
 
 
453
  ax.set_xticklabels([]) #remove x label
454
 
455
 
 
456
 
457
+ # Wrapping labels
458
  max_label_width = 10
 
 
459
  labels = ax.get_yticklabels()
460
+ wrapped_labels = [textwrap.fill(label.get_text(), width=max_label_width) for label in labels] # Wrap the labels if they exceed the max width
 
 
 
 
461
  ax.set_yticklabels(wrapped_labels, fontsize=16, color='white')
462
 
463
  #no borders
464
  for spine in ax.spines.values():
465
  spine.set_visible(False)
466
 
467
+ ax.set_title(class_names[-1], color='white', fontsize=24, fontweight='bold', ha='center')
468
 
469
  st.pyplot(fig) # Display the plot
470