CoolFace
Datasetpublic

ysn-rfd/text-dataset-tiny-code-script-py-format

USED of tahamajs/medicine_ds_persian for .parquet file USED of Alijafarixcs2/persian-it-llama2-2k for .parquet file USED of Abirate/english_quotes for .jsonl file NEW FILES (05/12/2025) NEW FILES (12/26/2025) NEW FILES (02/15/2026)

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
3likes1.6kdownloads
telegram_gemini.py35 linesDownload Raw Back to python
1import requests2from telegram import Update3from telegram.ext import ApplicationBuilder, MessageHandler, ContextTypes, filters4 5BOT_TOKEN = ""6LLAMA_API_URL = "http://127.0.0.1:8080/completion"7 8# گرفتن پاسخ از llama.cpp9def get_llama_response(prompt):10    system_prompt = f"User: {prompt}\nAssistant:"11    payload = {12        "prompt": system_prompt,13        "max_tokens": 64,14        "temperature": 0.7,15        "stop": ["</s>", "User:"]16    }17    response = requests.post(LLAMA_API_URL, json=payload)18    if response.ok:19        return response.json()["content"].strip()20    else:21        return "خطا در ارتباط با مدل زبان."22 23 24# هندل کردن پیام‌هایی که با / شروع می‌شن25async def handle_command(update: Update, context: ContextTypes.DEFAULT_TYPE):26    message = update.message27    user_input = message.text.lstrip('/gemma')  # حذف اسلش اول28    reply = get_llama_response(user_input)29    await message.reply_text(reply)30 31# راه‌اندازی ربات32app = ApplicationBuilder().token(BOT_TOKEN).build()33app.add_handler(MessageHandler(filters.COMMAND, handle_command))34app.run_polling()35