Jerimee commited on
Commit
91942a5
β€’
1 Parent(s): ad4ff4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -5,7 +5,8 @@ tokenizer = AutoTokenizer.from_pretrained("Jerimee/autotrain-dontknowwhatImdoing
5
  model = AutoModelForSequenceClassification.from_pretrained("Jerimee/autotrain-dontknowwhatImdoing-980432459")
6
 
7
  # I don't know what Im doing
8
- sentiment = pipeline("text-classification", model=model, tokenizer=tokenizer)
 
9
 
10
  #outputs = model( **kwargs )
11
  #inputs = "text",
@@ -13,15 +14,13 @@ sentiment = pipeline("text-classification", model=model, tokenizer=tokenizer)
13
 
14
 
15
  def get_sentiment(input_text):
16
- return sentiment(input_text)
17
 
18
- if __name__ == "__main__":
19
- iface = gr.Interface(
20
  fn = get_sentiment,
21
- #inputs = "text",
22
- outputs = model( **kwargs ),
23
- inputs = tokenizer("I love AutoTrain", return_tensors="pt"),
24
- #outputs = model(**inputs),
25
  title = 'Silly Name',
26
  description = 'Enter a name. Thing tells you if name is a silly',
27
  btn = gr.Button("Run"),
@@ -35,5 +34,5 @@ if __name__ == "__main__":
35
  ["Darnell"],
36
  ["Clubrubble"]
37
  ]
38
- )
39
- iface.launch() #inline = False
 
5
  model = AutoModelForSequenceClassification.from_pretrained("Jerimee/autotrain-dontknowwhatImdoing-980432459")
6
 
7
  # I don't know what Im doing
8
+ #sentiment = pipeline("text-classification", model=model, tokenizer=tokenizer)
9
+ classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
10
 
11
  #outputs = model( **kwargs )
12
  #inputs = "text",
 
14
 
15
 
16
  def get_sentiment(input_text):
17
+ return classifier(input_text)
18
 
19
+
20
+ iface = gr.Interface(
21
  fn = get_sentiment,
22
+ inputs = "text",
23
+ outputs = ['text'],
 
 
24
  title = 'Silly Name',
25
  description = 'Enter a name. Thing tells you if name is a silly',
26
  btn = gr.Button("Run"),
 
34
  ["Darnell"],
35
  ["Clubrubble"]
36
  ]
37
+ )
38
+ iface.launch() #inline = False