Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,8 @@ import requests
|
|
| 8 |
|
| 9 |
model = ""
|
| 10 |
duration = 5
|
|
|
|
|
|
|
| 11 |
|
| 12 |
print(f"Is CUDA available: {torch.cuda.is_available()}")
|
| 13 |
print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
|
|
@@ -68,7 +70,7 @@ def respond(message, history: list[tuple[str, str]], model, system_message, max_
|
|
| 68 |
print(model)
|
| 69 |
model_name = choose_model(model)
|
| 70 |
|
| 71 |
-
client = InferenceClient(model_name, token=os.getenv('deepseekv2'))
|
| 72 |
|
| 73 |
messages = [{"role": "system", "content": system_message}]
|
| 74 |
|
|
@@ -101,16 +103,6 @@ demo = gr.ChatInterface(
|
|
| 101 |
]
|
| 102 |
)
|
| 103 |
|
| 104 |
-
headers = {"Authorization": f"Bearer {os.getenv('deepseekv2')}"}
|
| 105 |
-
|
| 106 |
-
response = requests.get("https://api.huggingface.co/account", headers=headers)
|
| 107 |
-
|
| 108 |
-
if response.status_code == 200:
|
| 109 |
-
account_info = response.json()
|
| 110 |
-
compute_time_remaining = account_info["compute_time_remaining"]
|
| 111 |
-
print(f"Compute time remaining: {compute_time_remaining} seconds")
|
| 112 |
-
else:
|
| 113 |
-
print("Error:", response.status_code)
|
| 114 |
|
| 115 |
if __name__ == "__main__":
|
| 116 |
demo.launch()
|
|
|
|
| 8 |
|
| 9 |
model = ""
|
| 10 |
duration = 5
|
| 11 |
+
token = os.getenv('deepseekv2')
|
| 12 |
+
provider = 'together' #'fal-ai' #None
|
| 13 |
|
| 14 |
print(f"Is CUDA available: {torch.cuda.is_available()}")
|
| 15 |
print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
|
|
|
|
| 70 |
print(model)
|
| 71 |
model_name = choose_model(model)
|
| 72 |
|
| 73 |
+
client = InferenceClient(model_name, token=os.getenv('deepseekv2'), provider=provider)
|
| 74 |
|
| 75 |
messages = [{"role": "system", "content": system_message}]
|
| 76 |
|
|
|
|
| 103 |
]
|
| 104 |
)
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
if __name__ == "__main__":
|
| 108 |
demo.launch()
|