Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,17 +12,17 @@ pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, device_map=
|
|
| 12 |
def chat(question):
|
| 13 |
messages = [{"role": "user", "content": question}]
|
| 14 |
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, truncation=True)
|
| 15 |
-
outputs = pipe(prompt, max_length=
|
| 16 |
return outputs["generated_text"]
|
| 17 |
|
| 18 |
# Set up the Gradio interface
|
| 19 |
iface = gr.Interface(
|
| 20 |
fn=chat,
|
| 21 |
-
inputs=gr.Textbox(lines=2, placeholder="
|
| 22 |
outputs="text",
|
| 23 |
-
title="
|
| 24 |
-
description="
|
| 25 |
)
|
| 26 |
|
| 27 |
# Launch the interface
|
| 28 |
-
iface.launch(
|
|
|
|
| 12 |
def chat(question):
|
| 13 |
messages = [{"role": "user", "content": question}]
|
| 14 |
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, truncation=True)
|
| 15 |
+
outputs = pipe(prompt, max_length=1024, truncation=True)[0]
|
| 16 |
return outputs["generated_text"]
|
| 17 |
|
| 18 |
# Set up the Gradio interface
|
| 19 |
iface = gr.Interface(
|
| 20 |
fn=chat,
|
| 21 |
+
inputs=gr.Textbox(lines=2, placeholder="Kérdezz valamit..."),
|
| 22 |
outputs="text",
|
| 23 |
+
title="Teszt Chatbot",
|
| 24 |
+
description="SambaLingo-Hungarian-Chat model"
|
| 25 |
)
|
| 26 |
|
| 27 |
# Launch the interface
|
| 28 |
+
iface.launch()
|