Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ from transformers import pipeline
|
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
|
|
|
5 |
|
6 |
# تحميل النموذج باستخدام GPU إذا متوفر
|
7 |
pipe = pipeline(
|
@@ -10,7 +11,7 @@ pipe = pipeline(
|
|
10 |
|
11 |
).cuda()
|
12 |
|
13 |
-
|
14 |
def respond(message, chat_history):
|
15 |
messages = [{"role": "user", "content": m[0]} for m in chat_history]
|
16 |
messages.append({"role": "user", "content": message})
|
|
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
|
5 |
+
import spaces
|
6 |
|
7 |
# تحميل النموذج باستخدام GPU إذا متوفر
|
8 |
pipe = pipeline(
|
|
|
11 |
|
12 |
).cuda()
|
13 |
|
14 |
+
@spaces.GPU
|
15 |
def respond(message, chat_history):
|
16 |
messages = [{"role": "user", "content": m[0]} for m in chat_history]
|
17 |
messages.append({"role": "user", "content": message})
|