Skip to content

Commit

Permalink
add gradio demo server
Browse files Browse the repository at this point in the history
  • Loading branch information
rfeinberg3 committed Oct 7, 2024
1 parent 0a699b8 commit 2b3d55c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
3 changes: 2 additions & 1 deletion classifiers/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
datasets
transformers
evaluate
torch
torch
gradio
20 changes: 20 additions & 0 deletions classifiers/src/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
import gradio as gr


def load_model() -> 'AutoModelForSequenceClassification':
""" Load Endian Classifier Model """
model_name = "ryfye181/distilbert_endian_classifier"
return AutoModelForSequenceClassification.from_pretrained(model_name)

def load_tokenizer() -> 'AutoTokenizer':
""" Load Tokenizer """
model_name = "ryfye181/distilbert_endian_classifier"
return AutoTokenizer.from_pretrained(model_name)

if __name__ == '__main__':

pipe = pipeline("text-classification", model=load_model(), tokenizer=load_tokenizer())

demo = gr.Interface().from_pipeline(pipe)
demo.launch()
10 changes: 0 additions & 10 deletions classifiers/src/endian_classifier.py

This file was deleted.

0 comments on commit 2b3d55c

Please sign in to comment.