scriptolip commited on
Commit
75c6905
·
verified ·
1 Parent(s): fd5c58c

update 4 app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -15
app.py CHANGED
@@ -1,17 +1,8 @@
1
- import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Загрузка модели
5
- model = pipeline("conversational", model="LLM360/K2-Chat")
6
-
7
- def chat(message, history):
8
- history.append((message, ""))
9
- response = model(history)
10
- history[-1] = (message, response[0]['generated_text'])
11
- return history, ""
12
-
13
- # Создание интерфейса
14
- iface = gr.ChatInterface(chat)
15
-
16
- # Запуск интерфейса
17
- iface.launch()
 
1
+ # Use a pipeline as a high-level helper
2
  from transformers import pipeline
3
 
4
+ messages = [
5
+ {"role": "user", "content": "Who are you?"},
6
+ ]
7
+ pipe = pipeline("text-generation", model="LLM360/K2-Chat")
8
+ pipe(messages)