Spaces:
Runtime error
Runtime error
File size: 1,412 Bytes
2765893 e7692af c635ea8 03fed78 c69f79a 03fed78 d17dc0b 9fcf154 2765893 9fcf154 a0fa0c4 c635ea8 e7bfb8d f0728e0 e7bfb8d 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-key-implementation', 'pharo-responsibilities', 'pharo-collaborators',
'python-summary', 'pharo-parameters', 'pharo-usage', 'pharo-development-notes', 'pharo-expand']
models = {}
for model_name in model_names:
models[model_name] = SetFitModel.from_pretrained("dvilasuero/setfit-mini-imdb")#f'AISE-TUDelft/{model_name}'
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)
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() |