is2win commited on
Commit
1ea4321
·
1 Parent(s): bf6fae4

new prompt

Browse files
Files changed (1) hide show
  1. app.py +5 -20
app.py CHANGED
@@ -35,33 +35,18 @@ llm = LlamaCpp(
35
  n_gpu_layers=-1,
36
  )
37
 
38
- def predict(input, history=[]):
39
  prompt_template = """
40
- <|start_header_id|>system<|end_header_id|>
41
- Вы личный ассистент по моде.
42
- ЗАПРЕЩАЮ ВЫДУМЫВАТЬ и вредить людям
43
- <|eot_id|>
44
- <|start_header_id|>user<|end_header_id|>
45
- Используй максимально emoji
46
- Ответь на вопросы строго на основе предоставленного Контекста.
47
- Если информация в контексте отсутствует, напиши сообщение "Ответа нет".
48
  Вопрос: {question_info}
49
- <|eom_id|>
50
  """
51
  prompt = PromptTemplate.from_template(prompt_template)
52
  llm_chain = prompt | llm
53
- question_info= """
54
- Привет
55
- """
56
- output = llm_chain.invoke({'question_info':question_info})
57
  return output
58
 
59
- #creating a gradio interface
60
-
61
- import gradio as gr
62
-
63
  demo = gr.Interface(fn=predict,
64
- inputs=["text", "state"],
65
- outputs=["chatbot", "state"])
66
 
67
  demo.launch()
 
35
  n_gpu_layers=-1,
36
  )
37
 
38
+ def predict(user_input):
39
  prompt_template = """
 
 
 
 
 
 
 
 
40
  Вопрос: {question_info}
 
41
  """
42
  prompt = PromptTemplate.from_template(prompt_template)
43
  llm_chain = prompt | llm
44
+ output = llm_chain.invoke({'question_info': user_input})
 
 
 
45
  return output
46
 
47
+ # Создание интерфейса Gradio
 
 
 
48
  demo = gr.Interface(fn=predict,
49
+ inputs="text",
50
+ outputs="text")
51
 
52
  demo.launch()