MegaTronX commited on
Commit
cabe2a2
·
verified ·
1 Parent(s): 1c17f7d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
2
+ import gradio as gr
3
+
4
+ model_name = "MegaTronX/Llama-3.2-1B-Instruct-Selectolax-QLoRA"
5
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
6
+ model = AutoModelForSequenceClassification.from_pretrained(model_name, from_tf=False)
7
+
8
+ def predict(text):
9
+ inputs = tokenizer(text, return_tensors="pt")
10
+ outputs = model(**inputs)
11
+ return outputs.logits.argmax().item()
12
+
13
+ demo = gr.Interface(
14
+ fn=predict,
15
+ inputs="text",
16
+ outputs="label"
17
+ )
18
+
19
+ demo.launch()