|
Mavjud biznes jarayonlariga sun’iy intellekt texnologiyalarini joriy etish bo‘yicha tavsiyalar
|
bet | 71/182 | Sana | 19.05.2024 | Hajmi | 5,69 Mb. | | #244351 |
Bog'liq Python sun\'iy intellekt texnologiyasi Dasrlik 2024 5.3.Mavjud biznes jarayonlariga sun’iy intellekt texnologiyalarini joriy etish bo‘yicha tavsiyalar
Python dasturlash tilida sun’iy intellekt yordamida biznes jarayonlarini avtomatlashtirishning ba’zi amaliy misollari:
Elektron pochtani qayta ishlashni avtomatlashtirish:
Elektron pochta xabarlarini avtomatik tahlil qilish va tasniflash uchun tabiiy tilni qayta ishlash uchun Space kutubxonasidan foydalaning.
import spacy
from spacy.matcher import Matcher
# Space modelini yuklab olish
nlp = spacy.load("en_core_web_sm")
# Elektron pochta xabarlarini tasniflash funktsiyasi
def classify_email(text):
doc = nlp(text)
matcher = Matcher(nlp.vocab)
# Kalit so‘zlarni topish uchun naqshlarni aniqlash
pattern1 = [{"LOWER": "urgent"}]
pattern2 = [{"LOWER": "meeting"}]
matcher.add("Urgent", None, pattern1)
matcher.add("Meeting", None, pattern2)
matches = matcher(doc)
if matches:
return " Muhim xat "
else:
return " Oddiy xat "
# Foydalanish misoli
email_text = " Uchrashuvga shoshilinch taklifnoma "
classification = classify_email(email_text)
print(classification)
Neyron tarmoqlar yordamida tasvirni qayta ishlash:
Tasvirlarni avtomatik ravishda tasniflaydigan neyron tarmoq modelini yaratish uchun TensorFlow kutubxonasidan foydalaning.
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.preprocessing import image
import numpy as np
# Oldindan tayyorlangan modelni yuklab olish
model = keras.applications.MobileNetV2(weights="imagenet")
# Tasvirni tasniflash funktsiyasi
def classify_image(image_path):
img = image.load_img(image_path, target_size=(224, 224))
img_array = image.img_to_array(img)
img_array = np.expand_dims(img_array, axis=0)
img_array = keras.applications.mobilenet_v2.preprocess_input(img_array)
predictions = model.predict(img_array)
decoded_predictions = keras.applications.mobilenet_v2.decode_predictions(predictions)
return decoded_predictions[0][0][1]
# Foydalanish misoli
image_path = " yo‘l_k_rasm.jpg "
classification = classify_image(image_path)
print(f" Tasvir tasnifi: {classification}")
|
| |