FuriouslyAsleep commited on
Commit
f7d01d2
1 Parent(s): e74b5ef

Update app.py

Browse files

fixed to do tech data classification

Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -1,7 +1,22 @@
1
  import gradio as gr
 
 
 
 
 
 
 
2
 
3
  def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
5
 
6
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
4
+ import torch
5
+
6
+ tokenizer = AutoTokenizer.from_pretrained("FuriouslyAsleep/unhappyZebra100")
7
+
8
+ model = AutoModelForSequenceClassification.from_pretrained("FuriouslyAsleep/unhappyZebra100")
9
 
10
  def greet(name):
11
+
12
+ inputs = tokenizer(name, return_tensors="pt")
13
+ outputs = model(**inputs)
14
+
15
+ predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
16
+ print(predictions)
17
+ # return "Hello " + name + "!!"
18
+ return "Probabilities are listed here (False prob, then True prob): ) + predictions
19
 
20
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
21
+ iface.launch()
22
+