Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,6 @@ from io import BytesIO
|
|
6 |
from PIL import Image
|
7 |
from transformers import pipeline
|
8 |
|
9 |
-
# Global pipelines
|
10 |
-
pipe_english = pipeline("text-classification", model="papluca/xlm-roberta-base-language-detection")
|
11 |
-
pipe_question = pipeline("text-classification", model="shahrukhx01/question-vs-statement-classifier")
|
12 |
|
13 |
# Define maximum dimensions for the fortune image (in pixels)
|
14 |
MAX_SIZE = (400, 400)
|
@@ -42,9 +39,11 @@ if "stick_clicked" not in st.session_state:
|
|
42 |
st.session_state.stick_clicked = False
|
43 |
|
44 |
def check_sentence_is_english_model(question):
|
|
|
45 |
return pipe_english(question)[0]['label'] == 'en'
|
46 |
|
47 |
def check_sentence_is_question_model(question):
|
|
|
48 |
return pipe_question(question)[0]['label'] == 'LABEL_1'
|
49 |
|
50 |
def submit_text_callback():
|
|
|
6 |
from PIL import Image
|
7 |
from transformers import pipeline
|
8 |
|
|
|
|
|
|
|
9 |
|
10 |
# Define maximum dimensions for the fortune image (in pixels)
|
11 |
MAX_SIZE = (400, 400)
|
|
|
39 |
st.session_state.stick_clicked = False
|
40 |
|
41 |
def check_sentence_is_english_model(question):
|
42 |
+
pipe_english = pipeline("text-classification", model="papluca/xlm-roberta-base-language-detection")
|
43 |
return pipe_english(question)[0]['label'] == 'en'
|
44 |
|
45 |
def check_sentence_is_question_model(question):
|
46 |
+
pipe_question = pipeline("text-classification", model="shahrukhx01/question-vs-statement-classifier")
|
47 |
return pipe_question(question)[0]['label'] == 'LABEL_1'
|
48 |
|
49 |
def submit_text_callback():
|