Spaces:
Sleeping
Sleeping
chore: Add GPU support
Browse files
app.py
CHANGED
@@ -1,15 +1,17 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
|
4 |
|
5 |
# Use a pipeline as a high-level helper
|
6 |
from transformers import pipeline
|
|
|
7 |
|
|
|
8 |
def llama3_1_8B(question):
|
9 |
messages = [
|
10 |
{"role": "user", "content": question},
|
11 |
]
|
12 |
-
pipe = pipeline("text-generation", model="NousResearch/Hermes-3-Llama-3.1-8B")
|
13 |
responses = pipe(messages)
|
14 |
return str(responses)
|
15 |
|
|
|
1 |
+
import spaces
|
2 |
import gradio as gr
|
3 |
|
4 |
|
5 |
|
6 |
# Use a pipeline as a high-level helper
|
7 |
from transformers import pipeline
|
8 |
+
pipe = pipeline("text-generation", model="NousResearch/Hermes-3-Llama-3.1-8B")
|
9 |
|
10 |
+
@spaces.GPU(duration=120)
|
11 |
def llama3_1_8B(question):
|
12 |
messages = [
|
13 |
{"role": "user", "content": question},
|
14 |
]
|
|
|
15 |
responses = pipe(messages)
|
16 |
return str(responses)
|
17 |
|