shrish191 commited on
Commit
0c2c30e
Β·
verified Β·
1 Parent(s): 585154c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -547,6 +547,7 @@ import cv2
547
  import numpy as np
548
  import re
549
 
 
550
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
551
  import torch
552
  from scipy.special import softmax
@@ -701,12 +702,25 @@ subreddit_interface = gr.Interface(
701
  title="Subreddit Sentiment Analysis",
702
  description="πŸ“Š Enter a subreddit to analyze sentiment of its top 20 hot posts."
703
  )
 
 
 
 
 
 
 
 
704
 
705
  # Combine tabs
706
- demo = gr.TabbedInterface(
707
  interface_list=[main_interface, subreddit_interface],
708
  tab_names=["General Sentiment Analysis", "Subreddit Analysis"]
709
  )
 
 
 
 
 
710
 
711
  demo.launch()
712
 
 
547
  import numpy as np
548
  import re
549
 
550
+ from evaluate import get_classification_report
551
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
552
  import torch
553
  from scipy.special import softmax
 
702
  title="Subreddit Sentiment Analysis",
703
  description="πŸ“Š Enter a subreddit to analyze sentiment of its top 20 hot posts."
704
  )
705
+ eval_interface = gr.Interface(
706
+ fn=lambda: get_classification_report(),
707
+ inputs=[],
708
+ outputs="text",
709
+ title="Evaluate Model",
710
+ description="Run evaluation on test.csv and view classification report."
711
+ )
712
+
713
 
714
  # Combine tabs
715
+ '''demo = gr.TabbedInterface(
716
  interface_list=[main_interface, subreddit_interface],
717
  tab_names=["General Sentiment Analysis", "Subreddit Analysis"]
718
  )
719
+ '''
720
+ demo = gr.TabbedInterface(
721
+ interface_list=[main_interface, subreddit_interface, eval_interface],
722
+ tab_names=["General Sentiment Analysis", "Subreddit Analysis", "Evaluate Model"]
723
+ )
724
 
725
  demo.launch()
726