peace4ever commited on
Commit
ac25ae6
1 Parent(s): 02c7de4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -16
app.py CHANGED
@@ -1,35 +1,30 @@
1
- # import streamlit as st
2
-
3
- # import torch as torch
4
- # from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoConfig
5
-
6
-
7
  import streamlit as st
 
 
8
  from transformers import pipeline
9
  from PIL import Image
10
 
11
- pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
 
12
 
13
- st.title("Hot Dog? Or Not?")
 
14
 
15
- file_name = st.file_uploader("Upload a hot dog candidate image")
16
-
17
- if file_name is not None:
18
  col1, col2 = st.columns(2)
19
 
20
- image = Image.open(file_name)
21
- col1.image(image, use_column_width=True)
22
- predictions = pipeline(image)
23
 
24
  col2.header("Probabilities")
25
  for p in predictions:
26
  col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
27
 
28
- # model_name = "peace4ever/roberta-large-finetuned-mongolian_v3"
29
  # tokenizer = AutoTokenizer.from_pretrained(model_name)
30
  # model = AutoModelForSequenceClassification.from_pretrained(model_name)
31
 
32
- # text = st.text_area("Өгүүлбэр оруулна уу?")
33
  # encoded_input = tokenizer(text, return_tensors="pt")
34
  # output = model(**encoded_input)
35
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import torch as torch
3
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoConfig
4
  from transformers import pipeline
5
  from PIL import Image
6
 
7
+ model_name = "peace4ever/roberta-large-finetuned-mongolian_v3"
8
+ pipeline = pipeline(task="sentiment-analysis", model=model_name)
9
 
10
+ st.title("Эерэг? Сөрөг эсвэл аль нь ч биш?")
11
+ text = st.text_area("Өгүүлбэр оруулна уу?")
12
 
13
+ if text is not None:
14
+
 
15
  col1, col2 = st.columns(2)
16
 
17
+ predictions = pipeline(text)
 
 
18
 
19
  col2.header("Probabilities")
20
  for p in predictions:
21
  col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
22
 
23
+
24
  # tokenizer = AutoTokenizer.from_pretrained(model_name)
25
  # model = AutoModelForSequenceClassification.from_pretrained(model_name)
26
 
27
+ #
28
  # encoded_input = tokenizer(text, return_tensors="pt")
29
  # output = model(**encoded_input)
30