Spaces:
Running
on
Zero
Running
on
Zero
enable zerogpu with decorator
Browse files- app.py +2 -0
- requirements.txt +1 -4
app.py
CHANGED
@@ -9,6 +9,7 @@ import torch
|
|
9 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
10 |
from huggingface_hub import hf_hub_download
|
11 |
from duckduckgo_search import DDGS
|
|
|
12 |
|
13 |
# ------------------------------
|
14 |
# Global Cancellation Event
|
@@ -107,6 +108,7 @@ def retrieve_context(query, max_results=6, max_chars_per_result=600):
|
|
107 |
# ------------------------------
|
108 |
# Chat Response Generation (Simulated Streaming) with Cancellation
|
109 |
# ------------------------------
|
|
|
110 |
def chat_response(user_message, chat_history, system_prompt, enable_search,
|
111 |
max_results, max_chars, model_name, max_tokens, temperature, top_k, top_p, repeat_penalty):
|
112 |
# Reset the cancellation event.
|
|
|
9 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
10 |
from huggingface_hub import hf_hub_download
|
11 |
from duckduckgo_search import DDGS
|
12 |
+
import spaces
|
13 |
|
14 |
# ------------------------------
|
15 |
# Global Cancellation Event
|
|
|
108 |
# ------------------------------
|
109 |
# Chat Response Generation (Simulated Streaming) with Cancellation
|
110 |
# ------------------------------
|
111 |
+
@spaces.GPU
|
112 |
def chat_response(user_message, chat_history, system_prompt, enable_search,
|
113 |
max_results, max_chars, model_name, max_tokens, temperature, top_k, top_p, repeat_penalty):
|
114 |
# Reset the cancellation event.
|
requirements.txt
CHANGED
@@ -1,7 +1,3 @@
|
|
1 |
-
--extra-index-url https://www.piwheels.org/simple
|
2 |
-
--extra-index-url https://github.com/GoogleCloudPlatform/gcloud-python-wheels/raw/refs/heads/master/wheelhouse
|
3 |
-
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
4 |
-
|
5 |
wheel
|
6 |
jieba
|
7 |
docopt
|
@@ -10,3 +6,4 @@ duckduckgo_search
|
|
10 |
gradio
|
11 |
torch
|
12 |
transformers
|
|
|
|
|
|
|
|
|
|
|
|
1 |
wheel
|
2 |
jieba
|
3 |
docopt
|
|
|
6 |
gradio
|
7 |
torch
|
8 |
transformers
|
9 |
+
spaces
|