injection10 commited on
Commit
205ef15
·
verified ·
1 Parent(s): fc187dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
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 respond(message, history):
 
 
 
 
 
10
 
11
- output = client.text_generation(message, max_new_tokens=512)
12
- return output
13
-
14
- demo = gr.ChatInterface(fn=respond)
 
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()