Spaces:
Sleeping
Sleeping
Return pipe inside the function
Browse files
app.py
CHANGED
@@ -1,23 +1,20 @@
|
|
1 |
import spaces
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
-
import ray
|
5 |
|
6 |
|
7 |
# Use a pipeline as a high-level helper
|
8 |
from transformers import pipeline
|
9 |
|
10 |
-
torch.cuda.empty_cache()
|
11 |
|
12 |
-
print("RUNNING PIPE")
|
13 |
-
pipe = pipeline("text-generation", model="NousResearch/Hermes-3-Llama-3.1-8B", max_new_tokens=200, device=0)
|
14 |
-
print("PIPE DONE")
|
15 |
|
16 |
-
|
17 |
@spaces.GPU(duration=120)
|
18 |
def llama3_1_8B(question):
|
19 |
|
20 |
-
|
|
|
|
|
21 |
messages = [
|
22 |
{"role": "user", "content": question},
|
23 |
]
|
|
|
1 |
import spaces
|
2 |
import gradio as gr
|
3 |
import torch
|
|
|
4 |
|
5 |
|
6 |
# Use a pipeline as a high-level helper
|
7 |
from transformers import pipeline
|
8 |
|
|
|
9 |
|
|
|
|
|
|
|
10 |
|
11 |
+
|
12 |
@spaces.GPU(duration=120)
|
13 |
def llama3_1_8B(question):
|
14 |
|
15 |
+
print("RUNNING PIPE")
|
16 |
+
pipe = pipeline("text-generation", model="NousResearch/Hermes-3-Llama-3.1-8B", max_new_tokens=200, device=0)
|
17 |
+
print("PIPE DONE")
|
18 |
messages = [
|
19 |
{"role": "user", "content": question},
|
20 |
]
|