Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,38 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
import json
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
# Hugging Face Inference
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def chat(message, history):
|
| 9 |
"""
|
| 10 |
-
Chat function
|
| 11 |
-
|
| 12 |
"""
|
| 13 |
try:
|
| 14 |
-
#
|
| 15 |
-
system_prompt = """You are
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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"
|