Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,16 +3,22 @@ from telegram import Update
|
|
3 |
from telegram.ext import Application, CommandHandler, MessageHandler, filters, CallbackContext
|
4 |
|
5 |
# β
Hugging Face Model Path
|
6 |
-
model_path = "
|
|
|
7 |
|
8 |
# β
Load Model
|
9 |
-
model = Llama
|
10 |
|
11 |
# β
Telegram Bot Token
|
12 |
TELEGRAM_BOT_TOKEN = "7881901341:AAEaE5gndeORmCuyzSwOyf2ELFLXHneCpiw"
|
13 |
|
14 |
def chat(prompt):
|
15 |
-
output = model(
|
|
|
|
|
|
|
|
|
|
|
16 |
return output["choices"][0]["text"]
|
17 |
|
18 |
# β
Telegram Commands
|
|
|
3 |
from telegram.ext import Application, CommandHandler, MessageHandler, filters, CallbackContext
|
4 |
|
5 |
# β
Hugging Face Model Path
|
6 |
+
model_path = "/app/models" # Tumhara actual model path
|
7 |
+
model_file = "model.gguf" # Model file name
|
8 |
|
9 |
# β
Load Model
|
10 |
+
model = Llama(model_path=f"{model_path}/{model_file}", n_ctx=4096)
|
11 |
|
12 |
# β
Telegram Bot Token
|
13 |
TELEGRAM_BOT_TOKEN = "7881901341:AAEaE5gndeORmCuyzSwOyf2ELFLXHneCpiw"
|
14 |
|
15 |
def chat(prompt):
|
16 |
+
output = model(
|
17 |
+
prompt=prompt, # Yeh correct syntax hai
|
18 |
+
max_tokens=200,
|
19 |
+
temperature=0.7,
|
20 |
+
top_p=0.9
|
21 |
+
)
|
22 |
return output["choices"][0]["text"]
|
23 |
|
24 |
# β
Telegram Commands
|