import streamlit as st from transformers import AutoModelForSequenceClassification from transformers import AutoTokenizer from transformers import TextClassificationPipeline from transformers import pipeline from optimum.onnxruntime import ORTModelForSequenceClassification from transformers import pipeline, AutoTokenizer from transformers import pipeline from pathlib import Path onnx_path = Path("onnx") model = ORTModelForSequenceClassification.from_pretrained(onnx_path, file_name="model_quantized.onnx") tokenizer = AutoTokenizer.from_pretrained(onnx_path) st.write("Airi.uz jamoasi amaliyotchilari tomonidan tayyorlangan text classification uchun mo'ljallangan model") st.write("Ishlatish uchun pastdagi maydonga matn kiriting va model sizga kiritilgan matnni qaysi sohaga aloqador ekanligini ko'rsatadi") input = st.text_area(label='input_areaf',placeholder='matnni shu yerga kiriting',height=350,max_chars = 5000) try: if st.button(label='bashorat qilish'): cls_pipeline = pipeline("text-classification", model=model, tokenizer=tokenizer) data = input st.info(cls_pipeline(data)) except RuntimeError: st.info("Iltimos kamroq malumot kiriting")