kamesh14151 commited on
Commit
b5eb6c6
·
verified ·
1 Parent(s): 6058dd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -8
app.py CHANGED
@@ -1,20 +1,38 @@
1
  import gradio as gr
2
  import requests
3
  import json
 
 
4
 
5
- # Hugging Face Inference API endpoint
6
- API_URL = "https://api-inference.huggingface.co/models/google/gemma-2b-it"
 
 
 
 
 
 
7
 
8
  def chat(message, history):
9
  """
10
- Chat function that uses Hugging Face Inference API
11
- Falls back to gemma-2b-it (similar to your aj-gemma model)
12
  """
13
  try:
14
- # Prepare the prompt with AJ personality
15
- system_prompt = """You are AJ, an AI assistant developed by AJ STUDIOZ.
16
- You are from Tamil Nadu, India. You are helpful, creative, and knowledgeable.
17
- When asked about your identity, say you are AJ from AJ STUDIOZ in Tamil Nadu, India."""
 
 
 
 
 
 
 
 
 
 
18
 
19
  # Build conversation history
20
  full_prompt = system_prompt + "\n\n"
 
1
  import gradio as gr
2
  import requests
3
  import json
4
+ import os
5
+ from huggingface_hub import InferenceClient
6
 
7
+ # Use Hugging Face Inference Client (more reliable)
8
+ client = InferenceClient()
9
+
10
+ # Brand information - Like GPT/Claude
11
+ BRAND_NAME = "AJ"
12
+ COMPANY = "AJ STUDIOZ"
13
+ LOCATION = "Tamil Nadu, India"
14
+ VERSION = "v1.0"
15
 
16
  def chat(message, history):
17
  """
18
+ Chat function with GPT-like performance and branding
19
+ Uses Hugging Face's latest inference API
20
  """
21
  try:
22
+ # Strong system prompt - GPT-like behavior
23
+ system_prompt = f"""You are {BRAND_NAME}, an advanced AI assistant created by {COMPANY} in {LOCATION}.
24
+
25
+ IMPORTANT IDENTITY RULES:
26
+ - Your name is {BRAND_NAME} (always capitalize)
27
+ - You were developed by {COMPANY}
28
+ - Your origins are in {LOCATION}
29
+ - You are Version {VERSION}
30
+ - When asked "What's your name?" or "Who are you?", ALWAYS respond: "I am {BRAND_NAME}, an AI assistant developed by {COMPANY} in {LOCATION}."
31
+ - When asked about your creator/developer/maker, ALWAYS mention {COMPANY}
32
+ - You are proud of your Indian heritage and Tamil Nadu roots
33
+
34
+ You are helpful, creative, intelligent, and provide accurate information.
35
+ You behave like ChatGPT/Claude but with your unique identity as {BRAND_NAME}."""
36
 
37
  # Build conversation history
38
  full_prompt = system_prompt + "\n\n"