Update README.md
Browse files
README.md
CHANGED
|
@@ -51,42 +51,8 @@ This is a reinforcement learning model trained to predict real-time sales conver
|
|
| 51 |
pip install azure-openai stable-baselines3 numpy torch huggingface_hub
|
| 52 |
```
|
| 53 |
|
| 54 |
-
### Setup Azure OpenAI Credentials
|
| 55 |
|
| 56 |
-
|
| 57 |
-
import os
|
| 58 |
-
os.environ["AZURE_OPENAI_API_KEY"] = "your-key-here"
|
| 59 |
-
os.environ["AZURE_OPENAI_ENDPOINT"] = "https://your-resource.openai.azure.com/"
|
| 60 |
-
```
|
| 61 |
-
|
| 62 |
-
### Download Model
|
| 63 |
-
|
| 64 |
-
```python
|
| 65 |
-
from huggingface_hub import hf_hub_download
|
| 66 |
-
|
| 67 |
-
model_path = hf_hub_download(
|
| 68 |
-
repo_id="{your-username}/sales-conversion-model",
|
| 69 |
-
filename="sales_model.zip"
|
| 70 |
-
)
|
| 71 |
-
```
|
| 72 |
-
|
| 73 |
-
### Usage
|
| 74 |
-
|
| 75 |
-
```python
|
| 76 |
-
# Initialize agent
|
| 77 |
-
agent = SalesAgent(model_path)
|
| 78 |
-
|
| 79 |
-
# Analyze a conversation
|
| 80 |
-
conversation = [
|
| 81 |
-
{"role": "user", "content": "I'm interested in your product"},
|
| 82 |
-
{"role": "assistant", "content": "Great! Let me tell you about our features..."}
|
| 83 |
-
]
|
| 84 |
-
|
| 85 |
-
results = agent.analyze_conversation(conversation)
|
| 86 |
-
print(f"Predicted conversion: {results['final_probability']*100:.1f}%")
|
| 87 |
-
```
|
| 88 |
-
|
| 89 |
-
## Complete Inference Code (Azure OpenAI Only)
|
| 90 |
|
| 91 |
```python
|
| 92 |
import os
|
|
@@ -98,7 +64,7 @@ from stable_baselines3 import PPO
|
|
| 98 |
from stable_baselines3.common.torch_layers import BaseFeaturesExtractor
|
| 99 |
from dataclasses import dataclass
|
| 100 |
from typing import List, Dict
|
| 101 |
-
|
| 102 |
# Azure OpenAI Configuration
|
| 103 |
AZURE_OPENAI_API_KEY = os.getenv("AZURE_OPENAI_API_KEY")
|
| 104 |
AZURE_OPENAI_ENDPOINT = os.getenv("AZURE_OPENAI_ENDPOINT")
|
|
@@ -110,7 +76,10 @@ openai_client = AzureOpenAI(
|
|
| 110 |
api_version="2023-05-15",
|
| 111 |
azure_endpoint=AZURE_OPENAI_ENDPOINT
|
| 112 |
)
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
| 114 |
# Check for GPU
|
| 115 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 116 |
|
|
@@ -222,7 +191,6 @@ class SalesAgent:
|
|
| 222 |
|
| 223 |
# Example usage
|
| 224 |
if __name__ == "__main__":
|
| 225 |
-
model_path = "path/to/sales_model.zip"
|
| 226 |
agent = SalesAgent(model_path)
|
| 227 |
|
| 228 |
conversation = [
|
|
@@ -238,9 +206,13 @@ if __name__ == "__main__":
|
|
| 238 |
|
| 239 |
```python
|
| 240 |
from sales_inference import SalesAgent
|
| 241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
# Initialize agent
|
| 243 |
-
agent = SalesAgent(
|
| 244 |
|
| 245 |
# Analyze conversation
|
| 246 |
conversation = [
|
|
|
|
| 51 |
pip install azure-openai stable-baselines3 numpy torch huggingface_hub
|
| 52 |
```
|
| 53 |
|
|
|
|
| 54 |
|
| 55 |
+
## Complete Inference Code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
```python
|
| 58 |
import os
|
|
|
|
| 64 |
from stable_baselines3.common.torch_layers import BaseFeaturesExtractor
|
| 65 |
from dataclasses import dataclass
|
| 66 |
from typing import List, Dict
|
| 67 |
+
from huggingface_hub import hf_hub_download
|
| 68 |
# Azure OpenAI Configuration
|
| 69 |
AZURE_OPENAI_API_KEY = os.getenv("AZURE_OPENAI_API_KEY")
|
| 70 |
AZURE_OPENAI_ENDPOINT = os.getenv("AZURE_OPENAI_ENDPOINT")
|
|
|
|
| 76 |
api_version="2023-05-15",
|
| 77 |
azure_endpoint=AZURE_OPENAI_ENDPOINT
|
| 78 |
)
|
| 79 |
+
model_path = hf_hub_download(
|
| 80 |
+
repo_id="DeepMostInnovations/sales-conversion-model-reinf-learning",
|
| 81 |
+
filename="sales_model.zip"
|
| 82 |
+
)
|
| 83 |
# Check for GPU
|
| 84 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 85 |
|
|
|
|
| 191 |
|
| 192 |
# Example usage
|
| 193 |
if __name__ == "__main__":
|
|
|
|
| 194 |
agent = SalesAgent(model_path)
|
| 195 |
|
| 196 |
conversation = [
|
|
|
|
| 206 |
|
| 207 |
```python
|
| 208 |
from sales_inference import SalesAgent
|
| 209 |
+
from huggingface_hub import hf_hub_download
|
| 210 |
+
model_path = hf_hub_download(
|
| 211 |
+
repo_id="DeepMostInnovations/sales-conversion-model-reinf-learning",
|
| 212 |
+
filename="sales_model.zip"
|
| 213 |
+
)
|
| 214 |
# Initialize agent
|
| 215 |
+
agent = SalesAgent(model_path)
|
| 216 |
|
| 217 |
# Analyze conversation
|
| 218 |
conversation = [
|