Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,14 +4,20 @@ from huggingface_hub import InferenceClient
|
|
| 4 |
|
| 5 |
token = os.getenv("SecretToken")
|
| 6 |
|
| 7 |
-
client = InferenceClient("ShadowEternity/CTFSolver", token=token)
|
| 8 |
|
| 9 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
| 15 |
|
| 16 |
if __name__ == "__name__":
|
| 17 |
demo.launch()
|
|
|
|
| 4 |
|
| 5 |
token = os.getenv("SecretToken")
|
| 6 |
|
| 7 |
+
client = InferenceClient("ShadowEternity/CTFSolver", token=token, timeout=120)
|
| 8 |
|
| 9 |
+
def chat_interface(message, history):
|
| 10 |
+
try:
|
| 11 |
+
respoce = cliet.text_generation(message, max_new_tokens=512, stream=False)
|
| 12 |
+
return response
|
| 13 |
+
except Exception as e:
|
| 14 |
+
return f"Erreur de conexion : {str(e)}. Veuillez reessayer dans quelques instants."
|
| 15 |
|
| 16 |
+
demo = gr.ChatInterface(
|
| 17 |
+
fn=chat_interface,
|
| 18 |
+
title="CTF Solver Assistant",
|
| 19 |
+
description="Assistatnt specialise en cybersecurite et resolution de CTF.
|
| 20 |
+
)
|
| 21 |
|
| 22 |
if __name__ == "__name__":
|
| 23 |
demo.launch()
|