STACC / app.py
aalkaswan's picture
Update app.py
df617d9
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()