File size: 1,461 Bytes
2765893
e7692af
c635ea8
 
03fed78
1cd80b7
 
03fed78
 
d17dc0b
a3ed488
2765893
 
9fcf154
 
a0fa0c4
 
 
c635ea8
e7bfb8d
 
 
 
f0728e0
e7bfb8d
df617d9
f0728e0
 
 
2765893
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import gradio as gr
import os
from setfit import SetFitModel

model_names = ['java-summary', 'java-pointer', 'java-deprecation', 'java-rational', 'java-ownership', 'java-usage', 'java-expand', 
          'pharo-example', 'pharo-keyimplementationpoints', 'pharo-responsibilities', 'pharo-collaborators',
          'python-summary', 'python-parameters', 'python-usage', 'python-developmentnotes', 'python-expand']

models = {}
for model_name in model_names:
    models[model_name] = SetFitModel.from_pretrained(f'AISE-TUDelft/{model_name}-classifier', tag='V1')#


def classify(text, model_name):
    if models[model_name]([text])[0]:
        return 'True'
    else:
        return 'False'
    
iface = gr.Interface(fn=classify, 
                     inputs=["text", gr.inputs.Dropdown(model_names, label='class')], 
                     outputs="text",
                    title='STACC',
                    description='''# STACC: a set of SentenceTransformer Assisted Comment Classifiers πŸ“š

This app showcases STACC, a collection of SetFit-based Comment classifiers created for the [NLBSE-2023 tool competition](https://nlbse2023.github.io/tools/). More details on the tool itself can be found in the [GitHub repo](https://github.com/AISE-TUDelft/STACC) or the [paper](https://arxiv.org/abs/2302.13149). 

To use the app, write a comment in the text box, and select the class you wish to test. Press Submit and watch the magic happen ✨
''')
iface.launch()