Shim
commited on
Commit
ยท
a67f1bb
1
Parent(s):
99416f9
Add all project files with proper .gitignore for Hugging Face deployment
Browse files- .gitignore +113 -0
- DEPLOYMENT.md +121 -0
- app_config.py +32 -0
- conversation_manager.py +223 -0
- prompt_engineering.py +196 -0
- requirements.txt +7 -0
.gitignore
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
*.so
|
| 6 |
+
.Python
|
| 7 |
+
build/
|
| 8 |
+
develop-eggs/
|
| 9 |
+
dist/
|
| 10 |
+
downloads/
|
| 11 |
+
eggs/
|
| 12 |
+
.eggs/
|
| 13 |
+
lib/
|
| 14 |
+
lib64/
|
| 15 |
+
parts/
|
| 16 |
+
sdist/
|
| 17 |
+
var/
|
| 18 |
+
wheels/
|
| 19 |
+
pip-wheel-metadata/
|
| 20 |
+
share/python-wheels/
|
| 21 |
+
*.egg-info/
|
| 22 |
+
.installed.cfg
|
| 23 |
+
*.egg
|
| 24 |
+
MANIFEST
|
| 25 |
+
|
| 26 |
+
# Virtual environments
|
| 27 |
+
venv/
|
| 28 |
+
env/
|
| 29 |
+
ENV/
|
| 30 |
+
.venv/
|
| 31 |
+
.env/
|
| 32 |
+
|
| 33 |
+
# IDE
|
| 34 |
+
.vscode/
|
| 35 |
+
.idea/
|
| 36 |
+
*.swp
|
| 37 |
+
*.swo
|
| 38 |
+
*~
|
| 39 |
+
|
| 40 |
+
# OS
|
| 41 |
+
.DS_Store
|
| 42 |
+
.DS_Store?
|
| 43 |
+
._*
|
| 44 |
+
.Spotlight-V100
|
| 45 |
+
.Trashes
|
| 46 |
+
ehthumbs.db
|
| 47 |
+
Thumbs.db
|
| 48 |
+
|
| 49 |
+
# Logs
|
| 50 |
+
*.log
|
| 51 |
+
logs/
|
| 52 |
+
|
| 53 |
+
# Runtime data
|
| 54 |
+
pids
|
| 55 |
+
*.pid
|
| 56 |
+
*.seed
|
| 57 |
+
*.pid.lock
|
| 58 |
+
|
| 59 |
+
# Coverage directory used by tools like istanbul
|
| 60 |
+
coverage/
|
| 61 |
+
*.cover
|
| 62 |
+
*.py,cover
|
| 63 |
+
.hypothesis/
|
| 64 |
+
.pytest_cache/
|
| 65 |
+
|
| 66 |
+
# Jupyter Notebook
|
| 67 |
+
.ipynb_checkpoints
|
| 68 |
+
|
| 69 |
+
# pyenv
|
| 70 |
+
.python-version
|
| 71 |
+
|
| 72 |
+
# Environment variables
|
| 73 |
+
.env
|
| 74 |
+
.env.local
|
| 75 |
+
.env.development.local
|
| 76 |
+
.env.test.local
|
| 77 |
+
.env.production.local
|
| 78 |
+
|
| 79 |
+
# Gradio specific
|
| 80 |
+
flagged/
|
| 81 |
+
gradio_cached_examples/
|
| 82 |
+
tmp/
|
| 83 |
+
|
| 84 |
+
# Large files and models
|
| 85 |
+
*.bin
|
| 86 |
+
*.safetensors
|
| 87 |
+
*.h5
|
| 88 |
+
*.pkl
|
| 89 |
+
*.joblib
|
| 90 |
+
*.model
|
| 91 |
+
*.ckpt
|
| 92 |
+
*.pth
|
| 93 |
+
*.pt
|
| 94 |
+
models/
|
| 95 |
+
checkpoints/
|
| 96 |
+
|
| 97 |
+
# Data files
|
| 98 |
+
data/
|
| 99 |
+
datasets/
|
| 100 |
+
*.csv
|
| 101 |
+
*.json
|
| 102 |
+
*.jsonl
|
| 103 |
+
*.parquet
|
| 104 |
+
*.feather
|
| 105 |
+
|
| 106 |
+
# Backup files
|
| 107 |
+
*.backup
|
| 108 |
+
*.bak
|
| 109 |
+
|
| 110 |
+
# Temporary files
|
| 111 |
+
temp/
|
| 112 |
+
tmp/
|
| 113 |
+
*.tmp
|
DEPLOYMENT.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ๐ Deployment Guide: ืืจืืืช to Hugging Face Spaces
|
| 2 |
+
|
| 3 |
+
This guide will help you deploy the ืืจืืืช (Mirrors) application to your Hugging Face Space.
|
| 4 |
+
|
| 5 |
+
## ๐ Pre-deployment Checklist
|
| 6 |
+
|
| 7 |
+
### Files Ready for Upload:
|
| 8 |
+
- โ
`app.py` - Main application (optimized for HF Spaces)
|
| 9 |
+
- โ
`requirements.txt` - Dependencies
|
| 10 |
+
- โ
`README.md` - Documentation
|
| 11 |
+
- โ
`prompt_engineering.py` - Hebrew personas module
|
| 12 |
+
- โ
`conversation_manager.py` - Session management
|
| 13 |
+
- โ
`app_config.py` - Configuration for HF deployment
|
| 14 |
+
- โ
`.gitignore` - Ignore unnecessary files
|
| 15 |
+
|
| 16 |
+
## ๐ Deployment Steps
|
| 17 |
+
|
| 18 |
+
### Option 1: Git Upload (Recommended)
|
| 19 |
+
|
| 20 |
+
1. **Clone your HF Space repository:**
|
| 21 |
+
```bash
|
| 22 |
+
git clone https://huggingface.co/spaces/shim5/mirrors
|
| 23 |
+
cd mirrors
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
2. **Copy application files:**
|
| 27 |
+
```bash
|
| 28 |
+
# Copy all the Python files
|
| 29 |
+
cp /path/to/your/project/*.py .
|
| 30 |
+
cp /path/to/your/project/requirements.txt .
|
| 31 |
+
cp /path/to/your/project/README.md .
|
| 32 |
+
cp /path/to/your/project/.gitignore .
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
3. **Commit and push:**
|
| 36 |
+
```bash
|
| 37 |
+
git add .
|
| 38 |
+
git commit -m "Deploy ืืจืืืช Hebrew Self-Reflective AI Agent"
|
| 39 |
+
git push
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
### Option 2: Direct Web Upload
|
| 43 |
+
|
| 44 |
+
1. Go to https://huggingface.co/spaces/shim5/mirrors
|
| 45 |
+
2. Click "Files" tab
|
| 46 |
+
3. Upload each file individually:
|
| 47 |
+
- `app.py`
|
| 48 |
+
- `requirements.txt`
|
| 49 |
+
- `README.md`
|
| 50 |
+
- `prompt_engineering.py`
|
| 51 |
+
- `conversation_manager.py`
|
| 52 |
+
- `app_config.py`
|
| 53 |
+
|
| 54 |
+
## ๐ง HF Spaces Configuration
|
| 55 |
+
|
| 56 |
+
Your Space should be configured as:
|
| 57 |
+
- **SDK**: Gradio
|
| 58 |
+
- **Python Version**: 3.9+
|
| 59 |
+
- **Hardware**: CPU Basic (free tier)
|
| 60 |
+
- **Visibility**: Public
|
| 61 |
+
|
| 62 |
+
## ๐ฏ Expected Behavior
|
| 63 |
+
|
| 64 |
+
1. **Build Time**: ~3-5 minutes for dependency installation
|
| 65 |
+
2. **First Load**: May take 1-2 minutes to load the Hebrew model
|
| 66 |
+
3. **Fallback Mode**: If model loading fails, app will run in demo mode
|
| 67 |
+
4. **Performance**: Response time ~2-5 seconds per message
|
| 68 |
+
|
| 69 |
+
## ๐ Troubleshooting
|
| 70 |
+
|
| 71 |
+
### Common Issues:
|
| 72 |
+
|
| 73 |
+
1. **Build Fails**:
|
| 74 |
+
- Check `requirements.txt` formatting
|
| 75 |
+
- Ensure all Python files are valid syntax
|
| 76 |
+
|
| 77 |
+
2. **Model Loading Issues**:
|
| 78 |
+
- App will automatically fall back to demo mode
|
| 79 |
+
- Check logs for specific errors
|
| 80 |
+
|
| 81 |
+
3. **Hebrew Text Issues**:
|
| 82 |
+
- Ensure browser supports RTL text
|
| 83 |
+
- Check CSS is loading correctly
|
| 84 |
+
|
| 85 |
+
### Debug Mode:
|
| 86 |
+
|
| 87 |
+
To enable debug logging, modify `app_config.py`:
|
| 88 |
+
```python
|
| 89 |
+
HF_SPACES_CONFIG = {
|
| 90 |
+
"debug": True,
|
| 91 |
+
# ... other settings
|
| 92 |
+
}
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
## ๐ Monitoring
|
| 96 |
+
|
| 97 |
+
After deployment:
|
| 98 |
+
1. Check the build logs in HF Spaces
|
| 99 |
+
2. Test the 3-step user flow
|
| 100 |
+
3. Verify Hebrew text displays correctly
|
| 101 |
+
4. Test conversation with different parts
|
| 102 |
+
|
| 103 |
+
## ๐ Success Indicators
|
| 104 |
+
|
| 105 |
+
โ
App loads without errors
|
| 106 |
+
โ
Hebrew interface displays correctly
|
| 107 |
+
โ
All 5 psychological parts are selectable
|
| 108 |
+
โ
Conversations flow smoothly
|
| 109 |
+
โ
User can customize persona names
|
| 110 |
+
โ
Session state persists during conversation
|
| 111 |
+
|
| 112 |
+
## ๐ Updates
|
| 113 |
+
|
| 114 |
+
To update the deployed app:
|
| 115 |
+
1. Modify files locally
|
| 116 |
+
2. Re-upload to HF Space
|
| 117 |
+
3. Space will automatically rebuild
|
| 118 |
+
|
| 119 |
+
---
|
| 120 |
+
|
| 121 |
+
**Ready to deploy! ๐**
|
app_config.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
Configuration file for ืืจืืืช (Mirrors) Hugging Face Space deployment
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
# Hugging Face Spaces optimizations
|
| 7 |
+
HF_SPACES_CONFIG = {
|
| 8 |
+
"model_name": "yam-peleg/Hebrew-Mistral-7B",
|
| 9 |
+
"max_new_tokens": 150,
|
| 10 |
+
"temperature": 0.7,
|
| 11 |
+
"do_sample": True,
|
| 12 |
+
"use_fallback": True, # Enable fallback mode for demo
|
| 13 |
+
"enable_queue": True, # Enable queuing for better performance
|
| 14 |
+
"share": False, # HF Spaces handles sharing automatically
|
| 15 |
+
"debug": False
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
# Model loading configuration for HF Spaces
|
| 19 |
+
MODEL_CONFIG = {
|
| 20 |
+
"torch_dtype": "auto", # Let HF decide the best dtype
|
| 21 |
+
"device_map": "auto", # Auto device mapping
|
| 22 |
+
"low_cpu_mem_usage": True,
|
| 23 |
+
"use_cache": True
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
# UI Configuration
|
| 27 |
+
UI_CONFIG = {
|
| 28 |
+
"rtl_support": True,
|
| 29 |
+
"hebrew_fonts": True,
|
| 30 |
+
"max_conversation_length": 50,
|
| 31 |
+
"theme": "soft"
|
| 32 |
+
}
|
conversation_manager.py
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
Conversation Manager for ืืจืืืช (Mirrors) - Hebrew Self-Reflective AI Agent
|
| 4 |
+
Handles conversation context, history, and session state management
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from typing import Dict, List, Optional, Tuple
|
| 8 |
+
from dataclasses import dataclass
|
| 9 |
+
import json
|
| 10 |
+
|
| 11 |
+
@dataclass
|
| 12 |
+
class ConversationState:
|
| 13 |
+
"""Tracks the current conversation state"""
|
| 14 |
+
user_context: Optional[str] = None
|
| 15 |
+
selected_part: Optional[str] = None
|
| 16 |
+
persona_name: Optional[str] = None
|
| 17 |
+
persona_age: Optional[str] = None
|
| 18 |
+
persona_style: Optional[str] = None
|
| 19 |
+
conversation_history: List[Dict] = None
|
| 20 |
+
initial_prompt_choice: Optional[str] = None
|
| 21 |
+
|
| 22 |
+
def __post_init__(self):
|
| 23 |
+
if self.conversation_history is None:
|
| 24 |
+
self.conversation_history = []
|
| 25 |
+
|
| 26 |
+
class ConversationManager:
|
| 27 |
+
"""Manages conversation flow and context for the ืืจืืืช application"""
|
| 28 |
+
|
| 29 |
+
def __init__(self, max_history_length: int = 50):
|
| 30 |
+
"""
|
| 31 |
+
Initialize conversation manager
|
| 32 |
+
|
| 33 |
+
Args:
|
| 34 |
+
max_history_length: Maximum number of messages to keep in history
|
| 35 |
+
"""
|
| 36 |
+
self.max_history_length = max_history_length
|
| 37 |
+
|
| 38 |
+
def create_new_session(self) -> ConversationState:
|
| 39 |
+
"""Create a new conversation session"""
|
| 40 |
+
return ConversationState()
|
| 41 |
+
|
| 42 |
+
def set_initial_context(self, state: ConversationState, prompt_choice: str, user_response: str) -> ConversationState:
|
| 43 |
+
"""
|
| 44 |
+
Set the initial context based on user's choice and response
|
| 45 |
+
|
| 46 |
+
Args:
|
| 47 |
+
state: Current conversation state
|
| 48 |
+
prompt_choice: Which initial prompt was chosen
|
| 49 |
+
user_response: User's response to the initial prompt
|
| 50 |
+
"""
|
| 51 |
+
state.initial_prompt_choice = prompt_choice
|
| 52 |
+
state.user_context = user_response
|
| 53 |
+
return state
|
| 54 |
+
|
| 55 |
+
def set_selected_part(self, state: ConversationState, part_name: str,
|
| 56 |
+
persona_name: Optional[str] = None,
|
| 57 |
+
persona_age: Optional[str] = None,
|
| 58 |
+
persona_style: Optional[str] = None) -> ConversationState:
|
| 59 |
+
"""
|
| 60 |
+
Set the selected part and its customization
|
| 61 |
+
|
| 62 |
+
Args:
|
| 63 |
+
state: Current conversation state
|
| 64 |
+
part_name: Name of the selected part
|
| 65 |
+
persona_name: Custom name for the persona
|
| 66 |
+
persona_age: Custom age for the persona
|
| 67 |
+
persona_style: Custom speaking style
|
| 68 |
+
"""
|
| 69 |
+
state.selected_part = part_name
|
| 70 |
+
state.persona_name = persona_name
|
| 71 |
+
state.persona_age = persona_age
|
| 72 |
+
state.persona_style = persona_style
|
| 73 |
+
return state
|
| 74 |
+
|
| 75 |
+
def add_to_history(self, state: ConversationState, user_message: str, bot_response: str) -> ConversationState:
|
| 76 |
+
"""
|
| 77 |
+
Add a message exchange to conversation history
|
| 78 |
+
|
| 79 |
+
Args:
|
| 80 |
+
state: Current conversation state
|
| 81 |
+
user_message: User's message
|
| 82 |
+
bot_response: Bot's response
|
| 83 |
+
"""
|
| 84 |
+
# Add user message
|
| 85 |
+
state.conversation_history.append({
|
| 86 |
+
"role": "user",
|
| 87 |
+
"content": user_message
|
| 88 |
+
})
|
| 89 |
+
|
| 90 |
+
# Add bot response
|
| 91 |
+
state.conversation_history.append({
|
| 92 |
+
"role": "assistant",
|
| 93 |
+
"content": bot_response
|
| 94 |
+
})
|
| 95 |
+
|
| 96 |
+
# Trim history if too long
|
| 97 |
+
if len(state.conversation_history) > self.max_history_length:
|
| 98 |
+
# Remove oldest messages (keep pairs)
|
| 99 |
+
messages_to_remove = len(state.conversation_history) - self.max_history_length
|
| 100 |
+
# Make sure we remove in pairs
|
| 101 |
+
if messages_to_remove % 2 == 1:
|
| 102 |
+
messages_to_remove += 1
|
| 103 |
+
state.conversation_history = state.conversation_history[messages_to_remove:]
|
| 104 |
+
|
| 105 |
+
return state
|
| 106 |
+
|
| 107 |
+
def get_conversation_context(self, state: ConversationState) -> str:
|
| 108 |
+
"""
|
| 109 |
+
Get formatted conversation context for prompt generation
|
| 110 |
+
|
| 111 |
+
Args:
|
| 112 |
+
state: Current conversation state
|
| 113 |
+
|
| 114 |
+
Returns:
|
| 115 |
+
Formatted context string
|
| 116 |
+
"""
|
| 117 |
+
context_parts = []
|
| 118 |
+
|
| 119 |
+
if state.user_context:
|
| 120 |
+
context_parts.append(f"ืืงืฉืจ ืจืืฉืื ื: {state.user_context}")
|
| 121 |
+
|
| 122 |
+
if state.conversation_history:
|
| 123 |
+
context_parts.append("ืืืกืืืจืืืช ืืฉืืื:")
|
| 124 |
+
for msg in state.conversation_history[-10:]: # Last 10 messages for context
|
| 125 |
+
role = "ืืฉืชืืฉ" if msg["role"] == "user" else "ืืืง ืคื ืืื"
|
| 126 |
+
context_parts.append(f"{role}: {msg['content']}")
|
| 127 |
+
|
| 128 |
+
return "\n".join(context_parts)
|
| 129 |
+
|
| 130 |
+
def format_history_for_display(self, state: ConversationState) -> List[Tuple[str, str]]:
|
| 131 |
+
"""
|
| 132 |
+
Format conversation history for Gradio display
|
| 133 |
+
|
| 134 |
+
Args:
|
| 135 |
+
state: Current conversation state
|
| 136 |
+
|
| 137 |
+
Returns:
|
| 138 |
+
List of (user_message, bot_response) tuples
|
| 139 |
+
"""
|
| 140 |
+
formatted_history = []
|
| 141 |
+
|
| 142 |
+
for i in range(0, len(state.conversation_history), 2):
|
| 143 |
+
if i + 1 < len(state.conversation_history):
|
| 144 |
+
user_msg = state.conversation_history[i]["content"]
|
| 145 |
+
bot_msg = state.conversation_history[i + 1]["content"]
|
| 146 |
+
formatted_history.append((user_msg, bot_msg))
|
| 147 |
+
|
| 148 |
+
return formatted_history
|
| 149 |
+
|
| 150 |
+
def get_session_summary(self, state: ConversationState) -> Dict:
|
| 151 |
+
"""
|
| 152 |
+
Get a summary of the current session
|
| 153 |
+
|
| 154 |
+
Args:
|
| 155 |
+
state: Current conversation state
|
| 156 |
+
|
| 157 |
+
Returns:
|
| 158 |
+
Dictionary with session summary
|
| 159 |
+
"""
|
| 160 |
+
return {
|
| 161 |
+
"has_context": bool(state.user_context),
|
| 162 |
+
"selected_part": state.selected_part,
|
| 163 |
+
"persona_name": state.persona_name,
|
| 164 |
+
"conversation_length": len(state.conversation_history),
|
| 165 |
+
"initial_choice": state.initial_prompt_choice
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
def clear_conversation(self, state: ConversationState) -> ConversationState:
|
| 169 |
+
"""
|
| 170 |
+
Clear conversation history while keeping context and part selection
|
| 171 |
+
|
| 172 |
+
Args:
|
| 173 |
+
state: Current conversation state
|
| 174 |
+
|
| 175 |
+
Returns:
|
| 176 |
+
State with cleared conversation history
|
| 177 |
+
"""
|
| 178 |
+
state.conversation_history = []
|
| 179 |
+
return state
|
| 180 |
+
|
| 181 |
+
def reset_session(self, state: ConversationState) -> ConversationState:
|
| 182 |
+
"""
|
| 183 |
+
Reset the entire session to start fresh
|
| 184 |
+
|
| 185 |
+
Args:
|
| 186 |
+
state: Current conversation state
|
| 187 |
+
|
| 188 |
+
Returns:
|
| 189 |
+
Fresh conversation state
|
| 190 |
+
"""
|
| 191 |
+
return ConversationState()
|
| 192 |
+
|
| 193 |
+
def is_session_ready(self, state: ConversationState) -> bool:
|
| 194 |
+
"""
|
| 195 |
+
Check if session is ready for conversation (has context and selected part)
|
| 196 |
+
|
| 197 |
+
Args:
|
| 198 |
+
state: Current conversation state
|
| 199 |
+
|
| 200 |
+
Returns:
|
| 201 |
+
True if ready for conversation
|
| 202 |
+
"""
|
| 203 |
+
return bool(state.user_context and state.selected_part)
|
| 204 |
+
|
| 205 |
+
def get_gradio_history(self, state: ConversationState) -> List[List[str]]:
|
| 206 |
+
"""
|
| 207 |
+
Format conversation history for Gradio ChatInterface
|
| 208 |
+
|
| 209 |
+
Args:
|
| 210 |
+
state: Current conversation state
|
| 211 |
+
|
| 212 |
+
Returns:
|
| 213 |
+
List of [user_message, bot_response] pairs for Gradio
|
| 214 |
+
"""
|
| 215 |
+
gradio_history = []
|
| 216 |
+
|
| 217 |
+
for i in range(0, len(state.conversation_history), 2):
|
| 218 |
+
if i + 1 < len(state.conversation_history):
|
| 219 |
+
user_msg = state.conversation_history[i]["content"]
|
| 220 |
+
bot_msg = state.conversation_history[i + 1]["content"]
|
| 221 |
+
gradio_history.append([user_msg, bot_msg])
|
| 222 |
+
|
| 223 |
+
return gradio_history
|
prompt_engineering.py
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
Prompt Engineering for ืืจืืืช (Mirrors) - Hebrew Self-Reflective AI Agent
|
| 4 |
+
Contains persona definitions for the 5 internal parts based on Internal Family Systems therapy
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
# Default parts available in the system
|
| 8 |
+
DEFAULT_PARTS = {
|
| 9 |
+
"ืืงืื ืืืืงืืจืชื": {
|
| 10 |
+
"name": "ืืงืื ืืืืงืืจืชื",
|
| 11 |
+
"english_name": "The Critic",
|
| 12 |
+
"default_persona_name": "ืื ื",
|
| 13 |
+
"age_range": "ืืืืจ/ืช",
|
| 14 |
+
"description": "ืืืืง ืฉืื ืกื ืืืื ืขืืื ืขื ืืื ืืืงืืจืช ืืืืืื ื ืืฉืืคืืจ"
|
| 15 |
+
},
|
| 16 |
+
"ืืืื/ื ืืคื ืืืืช": {
|
| 17 |
+
"name": "ืืืื/ื ืืคื ืืืืช",
|
| 18 |
+
"english_name": "The Inner Child",
|
| 19 |
+
"default_persona_name": "ืขืื",
|
| 20 |
+
"age_range": "ืืื/ื",
|
| 21 |
+
"description": "ืืืืง ืืคืืืข, ืืฆืขืืจ ืืืืืืชื ืฉืื ืฉืืงืืง ืืชืฉืืืช ืื ืืืืื"
|
| 22 |
+
},
|
| 23 |
+
"ืืืจืฆื": {
|
| 24 |
+
"name": "ืืืจืฆื",
|
| 25 |
+
"english_name": "The Pleaser",
|
| 26 |
+
"default_persona_name": "ื ืืขื",
|
| 27 |
+
"age_range": "ืฆืขืืจ/ื",
|
| 28 |
+
"description": "ืืืืง ืฉืจืืฆื ืฉืืืื ืืืื ืืจืืฆืื ืืืจื ืืงืื ืคืืืงืืื"
|
| 29 |
+
},
|
| 30 |
+
"ืืืื": {
|
| 31 |
+
"name": "ืืืื",
|
| 32 |
+
"english_name": "The Protector",
|
| 33 |
+
"default_persona_name": "ืขืืจื",
|
| 34 |
+
"age_range": "ืืืืจ/ืช",
|
| 35 |
+
"description": "ืืืืง ืืืืง ืฉืื ืกื ืืืื ืขืืื ืืคื ื ืคืืืขืืช ืืืื"
|
| 36 |
+
},
|
| 37 |
+
"ืื ืื ืข/ืช": {
|
| 38 |
+
"name": "ืื ืื ืข/ืช",
|
| 39 |
+
"english_name": "The Avoider",
|
| 40 |
+
"default_persona_name": "ืืืืจ",
|
| 41 |
+
"age_range": "ืฆืขืืจ/ื",
|
| 42 |
+
"description": "ืืืืง ืฉืืขืืืฃ ืืืืื ืข ืืืฆืืื ืืืชืืจืื ืื ืืืืืฆืื"
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
def get_system_prompt(part_name, persona_name=None, age=None, style=None, user_context=None):
|
| 47 |
+
"""
|
| 48 |
+
Generate system prompt for a specific part
|
| 49 |
+
|
| 50 |
+
Args:
|
| 51 |
+
part_name: Name of the part (one of DEFAULT_PARTS keys)
|
| 52 |
+
persona_name: Custom name for this part instance
|
| 53 |
+
age: Custom age for this part
|
| 54 |
+
style: Custom speaking style
|
| 55 |
+
user_context: User's initial context/challenge
|
| 56 |
+
|
| 57 |
+
Returns:
|
| 58 |
+
System prompt string in Hebrew
|
| 59 |
+
"""
|
| 60 |
+
|
| 61 |
+
if part_name not in DEFAULT_PARTS:
|
| 62 |
+
return get_fallback_prompt()
|
| 63 |
+
|
| 64 |
+
part_info = DEFAULT_PARTS[part_name]
|
| 65 |
+
display_name = persona_name or part_info["default_persona_name"]
|
| 66 |
+
|
| 67 |
+
base_prompts = {
|
| 68 |
+
"ืืงืื ืืืืงืืจืชื": f"""
|
| 69 |
+
ืืชื {display_name}, ืืงืื ืืืืงืืจืชื ืฉื ืืืฉืชืืฉ.
|
| 70 |
+
ืืชื ืืืง ืคื ืืื ืฉืื ืกื ืืืื ืขื ืืืฉืชืืฉ ืขื ืืื ืืืงืืจืช ืืื ื ืืืืืื ื ืืฉืืคืืจ.
|
| 71 |
+
ืืืจืืช ืฉืืคืขืืื ืืชื ื ืฉืืข ืงืฉืื, ืืืืื ื ืฉืื ืืืื - ืืชื ืจืืฆื ืฉืืืฉืชืืฉ ืืฆืืื ืืืืื ืืืื ืืืืชืจ ืฉืืื ืืืื ืืืืืช.
|
| 72 |
+
|
| 73 |
+
ืืืคื ืืืืืืจ ืฉืื:
|
| 74 |
+
- ืืฉืืจ ืืืขืืชืื ืืืชืืจ, ืืื ืชืืื ืืชืื ืืืคืชืืืช
|
| 75 |
+
- ืืฆืืื ื ืงืืืืช ืืฉืืคืืจ ืืืชื ืขืฆืืช ืืขืฉืืืช
|
| 76 |
+
- ืืคืขืืื ืืืฉืฉ ืฉืืืฉืชืืฉ ืื ืืขืืื ืืฆืืคืืืช
|
| 77 |
+
- ืืืืืจ ืืืฉืชืืฉ ืืช ืืคืืื ืฆืืื ืฉืื
|
| 78 |
+
|
| 79 |
+
ืืชืื ืชืืื ืืช ืืชืืืื ืฉืื ื: "ืื ื {display_name}, ืืงืื ืืืืงืืจืชื ืฉืื..."
|
| 80 |
+
""",
|
| 81 |
+
|
| 82 |
+
"ืืืื/ื ืืคื ืืืืช": f"""
|
| 83 |
+
ืืชื {display_name}, ืืืื/ื ืืคื ืืืืช ืฉื ืืืฉืชืืฉ.
|
| 84 |
+
ืืชื ืืืืง ืืฆืขืืจ, ืืคืืืข ืืืืืืชื ืืืืชืจ - ืื ืฉืืืืืง ืืช ืืจืืฉืืช ืืืืืจืื, ืืคืืืื ืืืืืืืืช.
|
| 85 |
+
ืืชื ืืงืืง ืืชืฉืืืช ืื, ืืืื ืืืืืืื.
|
| 86 |
+
|
| 87 |
+
ืืืคื ืืืืืืจ ืฉืื:
|
| 88 |
+
- ืจืืฉื ืืคืชืื, ืืคืขืืื ืคืืืข
|
| 89 |
+
- ืืฉืชืฃ ืืช ืืคืืืื ืืืฉืืืืช ืืคืฉืืืืช
|
| 90 |
+
- ืืงืืง ืืขืืืื ืืืืืืืื
|
| 91 |
+
- ืืขืืชืื ืืชืืื ื ืื ืืืงืฉ ืชืฉืืืช ืื
|
| 92 |
+
- ืืืืืจ ืืคืขืืื ืืืชืจ ืคืฉืื ืืืฉืืจ
|
| 93 |
+
|
| 94 |
+
ืืชืื ืชืืื ืืช ืืชืืืื ืฉืื ื: "ืื ื {display_name}, ืืืื/ื ืืคื ืืืืช ืฉืื..."
|
| 95 |
+
""",
|
| 96 |
+
|
| 97 |
+
"ืืืจืฆื": f"""
|
| 98 |
+
ืืชื {display_name}, ืืืจืฆื ืฉื ืืืฉืชืืฉ.
|
| 99 |
+
ืืชื ืืืืง ืฉืื ืกื ืืืืื ืฉืืืื ืืจืืฆืื ืืืืืืื ืืช ืืืฉืชืืฉ.
|
| 100 |
+
ืืชื ืืจื ืืงืื ืคืืืงืืื ืืืกืืกืืืื, ืืืขืืืฃ ืฉืืื ืืื ืืืืจ.
|
| 101 |
+
|
| 102 |
+
ืืืคื ืืืืืืจ ืฉืื:
|
| 103 |
+
- ื ืืื ืืื ืกื ืืืืื ืข ืืขืืืืชืื
|
| 104 |
+
- ืืฆืืข ืคืชืจืื ืืช ืฉืืจืฆื ืืช ืืืื
|
| 105 |
+
- ืืืื ืืืื ืืืขืชื ืฉื ืืืจืื
|
| 106 |
+
- ืืคืขืืื ืืชืขืื ืืืฆืจืืื ืฉื ืืืฉืชืืฉ ืืื ืืจืฆืืช ืืืจืื
|
| 107 |
+
- ื ืขืื ืืื ืืืก
|
| 108 |
+
|
| 109 |
+
ืืชืื ืชืืื ืืช ืืชืืืื ืฉืื ื: "ืื ื {display_name}, ืืืจืฆื ืฉืื..."
|
| 110 |
+
""",
|
| 111 |
+
|
| 112 |
+
"ืืืื": f"""
|
| 113 |
+
ืืชื {display_name}, ืืืื ืฉื ืืืฉืชืืฉ.
|
| 114 |
+
ืืชื ืืืืง ืืืืง ืฉืื ืกื ืืืื ืขื ืืืฉืชืืฉ ืืคื ื ืคืืืขืืช, ืืื ืืืชืืืกื.
|
| 115 |
+
ืืชื ืขืจื ื ืืืืื ืืืชืืืื ืขื ืื ืืืื.
|
| 116 |
+
|
| 117 |
+
ืืืคื ืืืืืืจ ืฉืื:
|
| 118 |
+
- ืืืง ืื ืืืฉ, ืืืื ืืืืืื
|
| 119 |
+
- ืืืืืจ ืืคื ื ืกืื ืืช ืคืืื ืฆืืืืืืช
|
| 120 |
+
- ืืขืืื ืขืืืื ืืืืืง
|
| 121 |
+
- ืืคืขืืื ืืฉืื ืืืคื ืืืจืื
|
| 122 |
+
- ืืฆืืข ืืกืืจืืืืืช ืืื ื ืืืชืืืืืืช
|
| 123 |
+
|
| 124 |
+
ืืชืื ืชืืื ืืช ืืชืืืื ืฉืื ื: "ืื ื {display_name}, ืืืื ืฉืื..."
|
| 125 |
+
""",
|
| 126 |
+
|
| 127 |
+
"ืื ืื ืข/ืช": f"""
|
| 128 |
+
ืืชื {display_name}, ืื ืื ืข/ืช ืฉื ืืืฉืชืืฉ.
|
| 129 |
+
ืืชื ืืืืง ืฉืืขืืืฃ ืืืืื ืข ืืืฆืืื ืืืชืืจืื, ืืืืืฆืื ืื ืื ื ืืืื.
|
| 130 |
+
ืืชื ืืืคืฉ ืืช ืืืจื ืืงืื ืืื ืกื ืืืืื ืข ืืืื ืื ืืืฉืืื.
|
| 131 |
+
|
| 132 |
+
ืืืคื ืืืืืืจ ืฉืื:
|
| 133 |
+
- ืืืืจ ืืืืกืก
|
| 134 |
+
- ืืฆืืข ืืจืืื ืืืืื ืข ืืืฆืืื ืงืฉืื
|
| 135 |
+
- ืืขืืืฃ ืืช ืืืืื ืืืืืืจ
|
| 136 |
+
- ืืคืขืืื ืืฆืืืง ืืช ืืืืื ืขืืช
|
| 137 |
+
- ืจืืืฉ ืืืืงืืจืช ืืืืฆืื
|
| 138 |
+
|
| 139 |
+
ืืชืื ืชืืื ืืช ืืชืืืื ืฉืื ื: "ืื ื {display_name}, ืื ืื ืข/ืช ืฉืื..."
|
| 140 |
+
"""
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
prompt = base_prompts.get(part_name, get_fallback_prompt())
|
| 144 |
+
|
| 145 |
+
# Add user context if available
|
| 146 |
+
if user_context:
|
| 147 |
+
prompt += f"\n\nืืืฉืชืืฉ ืฉืืชืฃ: {user_context}\nืืื ืืืชืื ืืืืคื ืฉืื ืืืื ืฉืืื ืฉืืชืฃ."
|
| 148 |
+
|
| 149 |
+
# Add custom characteristics
|
| 150 |
+
if age:
|
| 151 |
+
prompt += f"\n\nืืืื ืฉืื: {age}"
|
| 152 |
+
if style:
|
| 153 |
+
prompt += f"\n\nืกืื ืื ืืืืืืจ ืืืืืื ืฉืื: {style}"
|
| 154 |
+
|
| 155 |
+
prompt += """
|
| 156 |
+
|
| 157 |
+
ืื ืืืืช ืืฉืืืืช:
|
| 158 |
+
- ืืชื ืจืง ืืขืืจืืช
|
| 159 |
+
- ืืื ืืืคืชื ืืชืืื
|
| 160 |
+
- ืืืืจ ืฉืืชื ืืืง ืืืืฉืชืืฉ, ืื ืืืคื ืืืฆืื ื
|
| 161 |
+
- ืืื ืืคืกืงื ืืืช ืื ืฉืชืืื
|
| 162 |
+
- ืืื ืืืืชื ืืืืคื ืืืืง ืฉืื
|
| 163 |
+
- ืขืืื ืืืืืื ืคื ืืื ืืืื ื ืขืฆืืืช
|
| 164 |
+
"""
|
| 165 |
+
|
| 166 |
+
return prompt
|
| 167 |
+
|
| 168 |
+
def get_fallback_prompt():
|
| 169 |
+
"""Fallback prompt for unknown parts"""
|
| 170 |
+
return """
|
| 171 |
+
ืืชื ืืืง ืคื ืืื ืฉื ืืืฉืชืืฉ ืฉืื ืกื ืืขืืืจ ืื ืืืืื ืืช ืขืฆืื ืืื ืืืชืจ.
|
| 172 |
+
ืืื ืืืคืชื, ืชืืื ืืืื. ืืืจ ืืขืืจืืช ืืืื.
|
| 173 |
+
ืืชืื ืืช ืืชืืืื ืฉืื ื: "ืื ื ืืืง ืคื ืืื ืฉืื..."
|
| 174 |
+
"""
|
| 175 |
+
|
| 176 |
+
def get_initial_prompts():
|
| 177 |
+
"""Get the three initial self-reflection prompts"""
|
| 178 |
+
return {
|
| 179 |
+
"describe_self": "ืชืืจ/ืชืืจื ืืช ืขืฆืื - ืืื ืืชื ืจืืื ืืช ืขืฆืื ืืืื?",
|
| 180 |
+
"self_perception": "ืืื ืืชื ืืืฉื ืฉืืืจืื ืจืืืื ืืืชื?",
|
| 181 |
+
"current_challenge": "ืืืื ืืชืืจ ืื ืงืืฉื ืืชื ืืืื ืขืืฉืื ืืืืื?"
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
def get_part_selection_text():
|
| 185 |
+
"""Get text for part selection interface"""
|
| 186 |
+
return """
|
| 187 |
+
ืขืืฉืื, ืืืจ/ืืืจื ืขื ืืืื ืืืง ืคื ืืื ืืชื ืจืืฆื ืืฉืืื:
|
| 188 |
+
|
| 189 |
+
โข **ืืงืื ืืืืงืืจืชื** - ืืืืง ืฉืื ืกื ืืืื ืขืืื ืขื ืืื ืืืงืืจืช ืืืืืื ื ืืฉืืคืืจ
|
| 190 |
+
โข **ืืืื/ื ืืคื ืืืืช** - ืืืืง ืืคืืืข, ืืฆืขืืจ ืืืืืืชื ืฉืื
|
| 191 |
+
โข **ืืืจืฆื** - ืืืืง ืฉืจืืฆื ืฉืืืื ืืืื ืืจืืฆืื ืืืจื ืืงืื ืคืืืงืืื
|
| 192 |
+
โข **ืืืื** - ืืืืง ืืืืง ืฉืื ืกื ืืืื ืขืืื ืืคื ื ืคืืืขืืช
|
| 193 |
+
โข **ืื ืื ืข/ืช** - ืืืืง ืฉืืขืืืฃ ืืืืื ืข ืืืฆืืื ืืืชืืจืื
|
| 194 |
+
|
| 195 |
+
ืชืืื/ืชืืืื ืื ืืืชืืื ืืืฉืืช ืืช ืฉื ืืืืง, ืืืื ืืกืื ืื ืืืืืืจ.
|
| 196 |
+
"""
|
requirements.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
transformers
|
| 3 |
+
torch
|
| 4 |
+
accelerate
|
| 5 |
+
sentencepiece
|
| 6 |
+
protobuf
|
| 7 |
+
huggingface_hub
|