Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,6 @@ if not hf_token:
|
|
10 |
# Initialize InferenceClient
|
11 |
client = InferenceClient(model="huihui-ai/Llama-3.3-70B-Instruct-abliterated", token=hf_token)
|
12 |
|
13 |
-
|
14 |
def respond(
|
15 |
message,
|
16 |
history: list[tuple[str, str]],
|
@@ -33,9 +32,10 @@ def respond(
|
|
33 |
response = ""
|
34 |
|
35 |
try:
|
|
|
36 |
for message in client.chat_completion(
|
37 |
model="huihui-ai/Llama-3.3-70B-Instruct-abliterated",
|
38 |
-
|
39 |
parameters={
|
40 |
"max_tokens": max_tokens,
|
41 |
"temperature": temperature,
|
@@ -47,10 +47,8 @@ def respond(
|
|
47 |
response += token
|
48 |
yield response
|
49 |
except Exception as e:
|
50 |
-
yield f"Error: {str(e)}"
|
51 |
-
|
52 |
|
53 |
-
# Gradio Chat Interface
|
54 |
demo = gr.ChatInterface(
|
55 |
respond,
|
56 |
additional_inputs=[
|
|
|
10 |
# Initialize InferenceClient
|
11 |
client = InferenceClient(model="huihui-ai/Llama-3.3-70B-Instruct-abliterated", token=hf_token)
|
12 |
|
|
|
13 |
def respond(
|
14 |
message,
|
15 |
history: list[tuple[str, str]],
|
|
|
32 |
response = ""
|
33 |
|
34 |
try:
|
35 |
+
# Use 'messages' instead of 'inputs'
|
36 |
for message in client.chat_completion(
|
37 |
model="huihui-ai/Llama-3.3-70B-Instruct-abliterated",
|
38 |
+
messages=messages, # Correct argument
|
39 |
parameters={
|
40 |
"max_tokens": max_tokens,
|
41 |
"temperature": temperature,
|
|
|
47 |
response += token
|
48 |
yield response
|
49 |
except Exception as e:
|
50 |
+
yield f"Error: {str(e)}"
|
|
|
51 |
|
|
|
52 |
demo = gr.ChatInterface(
|
53 |
respond,
|
54 |
additional_inputs=[
|