File size: 3,536 Bytes
cd9d539
 
 
 
 
 
 
 
 
 
 
 
 
 
8a4f97d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
title: PlantInfo
emoji: 🦀
colorFrom: green
colorTo: blue
sdk: gradio
sdk_version: 5.17.1
app_file: app.py
pinned: false
license: apache-2.0
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

# 🌿 AI Plant Guide - English & Arabic

## Overview

AI Plant Guide is a user-friendly Gradio-based application that provides detailed plant information in both English and Arabic. By entering a plant name and selecting a language, users can access insights on scientific names, growing conditions, common uses, and care tips.

## Project Objectives
- Provide an AI-powered plant guide with bilingual support.
- Ensure user-friendly interaction through a web-based interface.
- Leverage state-of-the-art NLP models for accurate and informative responses.
- Offer quick and efficient responses using GPU acceleration.

## Implemented Pipelines
1. **User Input Handling**: 
   - The user enters a plant name and selects a language.
2. **Model Selection**:
   - Based on the chosen language, the appropriate transformer model is loaded:
     - **Microsoft Phi-3-mini-4k-instruct** for English
     - **ALLaM-7B-Instruct-preview** for Arabic
3. **Text Generation Pipeline**:
   - The selected model generates plant details, including:
     - Scientific name
     - Growing conditions
     - Common uses
     - Care tips
4. **Output Display**:
   - The generated information is displayed in a user-friendly interface.

## Instructions for Using the Interface
1. Open the **Gradio UI** in your browser.
2. Select a language (**English/Arabic**).
3. Enter a plant name (e.g., **Lavender**, **Aloe Vera**).
4. Click **"🔍 Get Plant Info"** to generate information.
5. View the plant details in the output box.

## Justification for Model and Pipeline Choices
- **Hugging Face Transformers**: Offers pre-trained state-of-the-art language models optimized for text generation.
- **Gradio**: Provides an easy-to-use web interface without the need for extensive frontend development.
- **PyTorch**: Ensures efficient model inference and flexibility for future enhancements.
- **GPU Acceleration**: Speeds up response times, improving user experience.
- **Pipeline-Based Design**: Ensures modularity and scalability for future improvements.

## Bilingual Implementation
- The project supports **English and Arabic** via two specialized transformer models.
- The UI allows users to choose their preferred language.
- The prompt structure is adapted for each language to ensure high-quality responses.

## Technologies Used
- **Gradio** for UI development
- **Transformers (Hugging Face)** for text generation
- **PyTorch** for model inference
- **Microsoft Phi-3-mini-4k-instruct** (English) and **ALLaM-7B-Instruct-preview** (Arabic) models
- **Spaces GPU Acceleration**

## Installation

### Prerequisites
Ensure you have Python installed (>=3.8) and required dependencies.

### Steps

1. **Clone the repository**:
   ```bash
   git clone https://huggingface.co/spaces/NoufSaleh46/PlantInfo1
   cd PlantInfo1
   ```
2. **Create a virtual environment (optional but recommended)**:
   ```bash
   python -m venv venv
   source venv/bin/activate  # On Windows use `venv\Scripts\activate`
   ```
3. **Install dependencies**:
   ```bash
   pip install -r requirements.txt
   ```
4. **Run the application**:
   ```bash
   python app.py
   ```

## Deployment
This project is deployed on **Hugging Face Spaces**. You can access it directly [here](https://huggingface.co/spaces/NoufSaleh46/PlantInfo1).