HaveAI commited on
Commit
1c37f2d
·
verified ·
1 Parent(s): 7429dea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -1,11 +1,19 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- pipe = pipeline("text-generation","TheBloke/Mistral-7B-Instruct-v0.1-GGUF")
 
5
 
6
  def chat_fn(message, history):
7
- response = pipe(message, max_new_tokens=200)[0]["generated_text"]
8
- return response
 
 
9
 
10
- gr.ChatInterface(fn=chat_fn).launch()
 
 
 
 
 
11
 
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Заменить модель на свою
5
+ pipe = pipeline("text-generation", model="название_твоей_модели")
6
 
7
  def chat_fn(message, history):
8
+ # Получаем ответ от модели
9
+ output = pipe(message, max_new_tokens=200)[0]['generated_text']
10
+ # Можно очистить префикс, если он дублирует prompt
11
+ return output.strip()
12
 
13
+ gr.ChatInterface(
14
+ fn=chat_fn,
15
+ title="Flare Chat",
16
+ theme="soft", # Можно убрать или изменить
17
+ examples=["Привет!", "Расскажи шутку", "Кто такой Эйнштейн?"],
18
+ ).launch()
19