Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 2 |
import torch
|
| 3 |
import gradio as gr
|
|
|
|
|
|
|
| 4 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 5 |
|
| 6 |
# تحميل النموذج والمحول
|
|
@@ -13,6 +15,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 13 |
device_map="auto",
|
| 14 |
trust_remote_code=True
|
| 15 |
)
|
|
|
|
| 16 |
|
| 17 |
# دالة الرد
|
| 18 |
def respond(message, chat_history):
|
|
@@ -47,4 +50,4 @@ chat = gr.ChatInterface(
|
|
| 47 |
)
|
| 48 |
|
| 49 |
# تشغيل التطبيق
|
| 50 |
-
chat.launch(
|
|
|
|
| 1 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 2 |
import torch
|
| 3 |
import gradio as gr
|
| 4 |
+
import spaces
|
| 5 |
+
|
| 6 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 7 |
|
| 8 |
# تحميل النموذج والمحول
|
|
|
|
| 15 |
device_map="auto",
|
| 16 |
trust_remote_code=True
|
| 17 |
)
|
| 18 |
+
@spaces.GPU
|
| 19 |
|
| 20 |
# دالة الرد
|
| 21 |
def respond(message, chat_history):
|
|
|
|
| 50 |
)
|
| 51 |
|
| 52 |
# تشغيل التطبيق
|
| 53 |
+
chat.launch()
|