Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,19 +4,14 @@ import spaces
|
|
| 4 |
import torch
|
| 5 |
import os
|
| 6 |
|
| 7 |
-
model=""
|
|
|
|
| 8 |
print(f"Is CUDA available: {torch.cuda.is_available()}")
|
| 9 |
-
# True
|
| 10 |
print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
|
| 11 |
-
# Tesla T4
|
| 12 |
|
| 13 |
"""
|
| 14 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 15 |
"""
|
| 16 |
-
# client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 17 |
-
# client = InferenceClient("deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B", token=os.getenv('deepseekv2'))
|
| 18 |
-
# client = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct", token=os.getenv('deepseekv2'))
|
| 19 |
-
# client = InferenceClient("meta-llama/Llama-3.1-8B-Instruct", token=os.getenv('deepseekv2'))
|
| 20 |
|
| 21 |
|
| 22 |
def choose_model(model_name):
|
|
@@ -53,7 +48,7 @@ def choose_model(model_name):
|
|
| 53 |
return model
|
| 54 |
|
| 55 |
|
| 56 |
-
@spaces.GPU(duration=
|
| 57 |
def respond(message, history: list[tuple[str, str]], model, system_message, max_tokens, temperature, top_p):
|
| 58 |
|
| 59 |
print(model)
|
|
@@ -83,8 +78,6 @@ def respond(message, history: list[tuple[str, str]], model, system_message, max_
|
|
| 83 |
"""
|
| 84 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 85 |
"""
|
| 86 |
-
|
| 87 |
-
|
| 88 |
|
| 89 |
demo = gr.ChatInterface(
|
| 90 |
respond,
|
|
|
|
| 4 |
import torch
|
| 5 |
import os
|
| 6 |
|
| 7 |
+
model = ""
|
| 8 |
+
duration = None
|
| 9 |
print(f"Is CUDA available: {torch.cuda.is_available()}")
|
|
|
|
| 10 |
print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
|
|
|
|
| 11 |
|
| 12 |
"""
|
| 13 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 14 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
def choose_model(model_name):
|
|
|
|
| 48 |
return model
|
| 49 |
|
| 50 |
|
| 51 |
+
@spaces.GPU(duration=duration)
|
| 52 |
def respond(message, history: list[tuple[str, str]], model, system_message, max_tokens, temperature, top_p):
|
| 53 |
|
| 54 |
print(model)
|
|
|
|
| 78 |
"""
|
| 79 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 80 |
"""
|
|
|
|
|
|
|
| 81 |
|
| 82 |
demo = gr.ChatInterface(
|
| 83 |
respond,
|