CoolFace
Apppublic

VikranthBhat/navigation-slm

sourceHugging Facemitupdated 9mo agoView on Hugging Face
0likes
App README

๐Ÿงญ TraderTreasure Navigation Assistant

This Space hosts an AI-powered navigation chatbot for the TraderTreasure commodity trading application.

โœจ Features

  • โ€”Natural Language Navigation - Just tell it where you want to go
  • โ€”Typo Tolerant - Handles misspellings gracefully
  • โ€”Category Aware - Understands the Master section hierarchy
  • โ€”High Accuracy - Trained on 500+ navigation patterns

๐Ÿš€ Usage

Web Interface

Simply type your query in the text box:

  • โ€”"take me to brokers"
  • โ€”"show clients in master"
  • โ€”"where can I see reports?"
  • โ€”"help" - lists all available pages

API Access

You can access this chatbot programmatically:

Using Gradio Client (Python)
python
from gradio_client import Client

client = Client("YOUR_USERNAME/navigation-chatbot")
result = client.predict(
    query="take me to brokers",
    api_name="/predict"
)
print(result)
# Output: {"route": "/management/brokers", "confidence": "98.5%", "query": "take me to brokers"}
Using Gradio Client (JavaScript/TypeScript)
typescript
import { Client } from "@gradio/client";

const client = await Client.connect("YOUR_USERNAME/navigation-chatbot");
const result = await client.predict("/predict", { 
    query: "take me to brokers" 
});
console.log(result.data);
Using REST API
bash
curl -X POST "https://YOUR_USERNAME-navigation-chatbot.hf.space/api/predict" \
  -H "Content-Type: application/json" \
  -d '{"data": ["take me to brokers"]}'

๐Ÿ“‚ Available Pages

General Section

PageRoute
Open Positions/management/open-positions
Transactions/management/transactions
Physical Gold/management/physical-gold
Reports/management/reports
Add Roll Value/management/add-roll
Excel Column Mapping/management/excel-column-mapping

Master Section

PageRoute
Brokers/management/brokers
Clients/management/clients
Commodity/management/commodity
Commodity Purity/management/commodity-purity
Commodity Type/management/commodity-type
Dealing Party/management/dealing-party
Physical Commodity Segment/management/physical-commodity-segment
Roles/management/roles
Rules/management/rules
Scripts/management/scripts
Segments/management/segments

๐Ÿ”ง Integration with Your App

NestJS Backend Integration

typescript
// navigation.service.ts
import { Injectable } from '@nestjs/common';

@Injectable()
export class NavigationService {
  private readonly apiUrl = 'https://YOUR_USERNAME-navigation-chatbot.hf.space/api/predict';

  async getNavigation(query: string): Promise<{route: string, confidence: string}> {
    const response = await fetch(this.apiUrl, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ data: [query] })
    });
    
    const result = await response.json();
    return JSON.parse(result.data[0]);
  }
}

React Frontend Integration

tsx
// useNavigation.ts
import { useState } from 'react';

export function useNavigation() {
  const [loading, setLoading] = useState(false);

  const navigate = async (query: string) => {
    setLoading(true);
    try {
      const response = await fetch('/api/chat/navigate', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ query })
      });
      const { route } = await response.json();
      if (route && !route.startsWith('HELP') && !route.startsWith('MASTER')) {
        window.location.href = route;
      }
      return route;
    } finally {
      setLoading(false);
    }
  };

  return { navigate, loading };
}

๐Ÿ“Š Model Information

  • โ€”Base Model: DistilBERT (distilbert-base-uncased)
  • โ€”Training Examples: 500+
  • โ€”Task: Text Classification (Navigation Intent)
  • โ€”Accuracy: ~95% on test set

๐Ÿ“ License

MIT License - Feel free to use and modify!

๐Ÿค Contributing

To add new pages to the model:

  1. 1.Update training_data.json with new examples
  2. 2.Re-train the model in Google Colab
  3. 3.Push updated model to Hugging Face Hub
  4. 4.The Space will automatically use the new model

Built with โค๏ธ for TraderTreasure