Spaces:
Sleeping
Sleeping
hello
Browse files
app.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
|
4 |
-
|
5 |
-
pipe = pipeline("text-generation", model="KoboldAI/fairseq-dense-13B-Shinen")
|
6 |
|
7 |
def respond(
|
8 |
message,
|
@@ -19,13 +18,13 @@ def respond(
|
|
19 |
prompt += f"Human: {message}\nAI:"
|
20 |
|
21 |
# Generate response
|
22 |
-
response =
|
23 |
prompt,
|
24 |
-
|
25 |
temperature=temperature,
|
26 |
top_p=top_p,
|
27 |
do_sample=True,
|
28 |
-
)
|
29 |
|
30 |
# Extract only the AI's response
|
31 |
ai_response = response.split("AI:")[-1].strip()
|
|
|
1 |
import gradio as gr
|
2 |
+
from huggingface_hub import InferenceClient
|
3 |
|
4 |
+
client = InferenceClient("KoboldAI/fairseq-dense-13B-Shinen")
|
|
|
5 |
|
6 |
def respond(
|
7 |
message,
|
|
|
18 |
prompt += f"Human: {message}\nAI:"
|
19 |
|
20 |
# Generate response
|
21 |
+
response = client.text_generation(
|
22 |
prompt,
|
23 |
+
max_new_tokens=max_tokens,
|
24 |
temperature=temperature,
|
25 |
top_p=top_p,
|
26 |
do_sample=True,
|
27 |
+
)
|
28 |
|
29 |
# Extract only the AI's response
|
30 |
ai_response = response.split("AI:")[-1].strip()
|