greco commited on
Commit
b822fbe
·
1 Parent(s): 2e98bd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -493,7 +493,7 @@ st.write(f'''
493
  Lets review all the tweets and how they fall into the categories of finance, politics, technology, and wildlife.
494
  ''')
495
 
496
- st.dataframe(zero_shot_results.style.highlight_max(axis=1, subset=['finance', 'politics', 'technology', 'wildlife'], props='color:white; background-color:green;').format(precision=2))
497
 
498
  st.write(f'''
499
  We can observe that the model does not have strong confidence in predicting the categories for some of the tweets.
@@ -526,10 +526,7 @@ st.write(f'''
526
  classification_sentiment_df = pd.merge(zero_shot_results_clean, sentiment_results[['sentiment']], how='left', left_index=True, right_index=True)
527
  classification_sentiment_df = classification_sentiment_df[['tweet', 'category', 'score', 'sentiment']]
528
 
529
- def highlight_sentiment(value):
530
- color = 'green' if value >= 0.5 else 'red'
531
- return 'color:{}'.format(color)
532
- st.dataframe(classification_sentiment_df.style.applymap(highlight_sentiment, subset=['sentiment']).format(precision=2))
533
 
534
  st.write(f'''
535
  The difficult part for zero-shot classification is defining the right set of categories for each business case.
@@ -571,5 +568,13 @@ fig.update_yaxes(range=[0, 1])
571
  fig.add_hline(y=0.5, line_width=3, line_color='darkgreen')
572
  st.plotly_chart(fig, use_container_width=True)
573
 
 
 
 
 
 
 
 
574
  st.write('\n')
575
- st.markdown('''---''')
 
 
493
  Lets review all the tweets and how they fall into the categories of finance, politics, technology, and wildlife.
494
  ''')
495
 
496
+ st.dataframe(zero_shot_results.style.format(precision=2))
497
 
498
  st.write(f'''
499
  We can observe that the model does not have strong confidence in predicting the categories for some of the tweets.
 
526
  classification_sentiment_df = pd.merge(zero_shot_results_clean, sentiment_results[['sentiment']], how='left', left_index=True, right_index=True)
527
  classification_sentiment_df = classification_sentiment_df[['tweet', 'category', 'score', 'sentiment']]
528
 
529
+ st.dataframe(classification_sentiment_df.style.format(precision=2))
 
 
 
530
 
531
  st.write(f'''
532
  The difficult part for zero-shot classification is defining the right set of categories for each business case.
 
568
  fig.add_hline(y=0.5, line_width=3, line_color='darkgreen')
569
  st.plotly_chart(fig, use_container_width=True)
570
 
571
+ st.markdown('''---''')
572
+ st.write('\n')
573
+ st.write('\n')
574
+
575
+ st.write('''
576
+ That's the end of the this demo 😎, the source code can be found on [Github](https://github.com/Greco1899/survey_analytics).
577
+ ''')
578
  st.write('\n')
579
+ st.image('https://images.unsplash.com/photo-1620712943543-bcc4688e7485?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2565&q=80')
580
+ st.caption('Photo by [Andrea De Santis](https://unsplash.com/@santesson89) on [Unsplash](https://unsplash.com).')