Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
import torch
|
|
|
|
|
|
|
|
|
4 |
|
5 |
# 1. تحميل النموذج
|
6 |
model_id = "yasserrmd/kallamni-1.2b-v1"
|
@@ -27,6 +31,7 @@ few_shot = [
|
|
27 |
]
|
28 |
|
29 |
# 3. دالة التوليد
|
|
|
30 |
def chat_fn(message, history):
|
31 |
try:
|
32 |
# Gradio ChatInterface history = list of dicts [{"role":..., "content":...}]
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
import torch
|
4 |
+
import spaces
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
|
9 |
# 1. تحميل النموذج
|
10 |
model_id = "yasserrmd/kallamni-1.2b-v1"
|
|
|
31 |
]
|
32 |
|
33 |
# 3. دالة التوليد
|
34 |
+
@spaces.GPU
|
35 |
def chat_fn(message, history):
|
36 |
try:
|
37 |
# Gradio ChatInterface history = list of dicts [{"role":..., "content":...}]
|