Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,20 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import os
|
| 3 |
from huggingface_hub import InferenceClient
|
|
|
|
| 4 |
|
| 5 |
-
|
| 6 |
-
client = InferenceClient("ShadowEternity/CTFsolver", token=token)
|
| 7 |
|
| 8 |
-
def
|
| 9 |
try:
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
| 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()
|