injection10 commited on
Commit
c387b44
·
verified ·
1 Parent(s): 9b8ee94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -1,24 +1,20 @@
1
  import gradio as gr
2
- import os
3
  from huggingface_hub import InferenceClient
 
4
 
5
- token = os.getenv("SecretToken")
6
- client = InferenceClient("ShadowEternity/CTFsolver", token=token)
7
 
8
- def solve_ctf(message, history):
9
  try:
10
- partial_text = ""
11
- for token_out in client.text_generation(message, max_new_tokens=512, stream=True):
12
- partial_text += token_out
13
- yield partial_text
 
14
  except Exception as e:
15
- yield f"Erreur : {str(e)}"
16
 
17
- demo = gr.ChatInterface(
18
- fn=solve_ctf,
19
- title="CTF Solver",
20
- description="Cybersecurity Assistant"
21
- )
22
 
23
  if __name__ == "__main__":
24
  demo.launch()
 
1
  import gradio as gr
 
2
  from huggingface_hub import InferenceClient
3
+ import os
4
 
5
+ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=os.getenv("SecretToken"))
 
6
 
7
+ def chat_fn(message, history):
8
  try:
9
+ response = ""
10
+
11
+ for msg in client.text_generation(message, max_new_tokens=512, stream=True):
12
+ response += msg
13
+ yield response
14
  except Exception as e:
15
+ yield f"❌ Erreur Technique: {str(e)}"
16
 
17
+ demo = gr.ChatInterface(fn=chat_fn, title="Test Connection")
 
 
 
 
18
 
19
  if __name__ == "__main__":
20
  demo.launch()