Jainesh212 commited on
Commit
bf43dc9
1 Parent(s): bdbbb0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import streamlit as st
 
 
 
2
  import transformers
3
- import torch
4
 
5
  # Define sentiment analysis models
6
  models = {
@@ -32,9 +34,15 @@ def app():
32
  results.append((model_name, label, score))
33
  st.success("Sentiment analysis complete!")
34
  st.write("Results:")
35
- for model_name, label, score in results:
36
- st.write(f"- {model_name}: {label} ({score:.2f})")
37
 
 
 
 
 
 
 
38
 
39
  # Run Streamlit app
40
  if __name__ == "__main__":
 
1
  import streamlit as st
2
+ import pandas as pd
3
+ import matplotlib.pyplot as plt
4
+ import seaborn as sns
5
  import transformers
 
6
 
7
  # Define sentiment analysis models
8
  models = {
 
34
  results.append((model_name, label, score))
35
  st.success("Sentiment analysis complete!")
36
  st.write("Results:")
37
+ df = pd.DataFrame(results, columns=["Model", "Sentiment", "Score"])
38
+ st.write(df)
39
 
40
+ # Plot results
41
+ sns.set_style("whitegrid")
42
+ fig, ax = plt.subplots()
43
+ sns.barplot(x="Model", y="Score", hue="Sentiment", data=df, ax=ax)
44
+ ax.set_title("Sentiment Analysis Results")
45
+ st.pyplot(fig)
46
 
47
  # Run Streamlit app
48
  if __name__ == "__main__":