Harsh-AI-Chat / app.py
Anshofgodkrishna's picture
Create app.py
da13c40 verified
raw
history blame contribute delete
848 Bytes
import gradio as gr
from huggingface_hub import hf_hub_download
from llama_cpp import Llama
# 1. आपकी GGUF फाइल को Hugging Face से डाउनलोड करना
# Note: अगर आपने GGUF अपलोड कर दी है, तो उसका नाम यहाँ लिखें
model_path = hf_hub_download(repo_id="Anshofgodkrishna/Harsh_AI_7B_Final", filename="Qwen2.5-7B.Q4_K_M.gguf")
# 2. मॉडल लोड करना
llm = Llama(model_path=model_path, n_ctx=2048)
# 3. चैट फंक्शन
def respond(message, history):
prompt = f"### Instruction: You are Harsh AI.\n### Input: {message}\n### Output:"
output = llm(prompt, max_tokens=150)
return output['choices'][0]['text']
# 4. इंटरफेस लॉन्च करना
gr.ChatInterface(respond).launch()