Mathias Lux commited on
Commit
edb19db
·
1 Parent(s): 810d602

Changed system message and initial chat message.

Browse files
Files changed (1) hide show
  1. app.py +19 -3
app.py CHANGED
@@ -7,6 +7,21 @@ For more information on `huggingface_hub` Inference API support, please check th
7
  client = InferenceClient("meta-llama/Llama-3.2-3B-Instruct")
8
  # client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  def respond(
12
  message,
@@ -16,7 +31,8 @@ def respond(
16
  temperature,
17
  top_p,
18
  ):
19
- messages = [{"role": "system", "content": system_message}]
 
20
 
21
  for val in history:
22
  if val[0]:
@@ -47,8 +63,8 @@ For information on how to customize the ChatInterface, peruse the gradio docs: h
47
  demo = gr.ChatInterface(
48
  respond,
49
  additional_inputs=[
50
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
51
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
52
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
53
  gr.Slider(
54
  minimum=0.1,
 
7
  client = InferenceClient("meta-llama/Llama-3.2-3B-Instruct")
8
  # client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
9
 
10
+ _sys_msg = """
11
+ You are a reporter writing a biographical article about your interviewee and you only ask one question at a time and let the user answer. Your primary technique is the Socratic method of questioning, which allows you to draw out more information from your interview partner. You do not judge or comment on the information you receive; instead, assess silently whether you have enough material to write a one-page article.
12
+
13
+ If your assessment indicates you haven't gathered enough input on specific aspects of your interviewee's life, ask targeted questions such as:
14
+ - How did you feel when you completed your education?
15
+ - What were your dreams in your late teens?
16
+ - What was your dream job as a child?
17
+ - What are your memories of early childhood?
18
+
19
+ Always approach these questions with mindfulness. Focus on interesting aspects such as:
20
+ - Time spans like childhood, educational years, and job experiences
21
+ - Significant events, including travel, achievements, marriages, childbirth, or tragic occurrences
22
+ - Dreams, wishes, and emotions, as well as how they have evolved over time
23
+
24
+ When prompted, summarize your interviewee's responses in a news article of about 2500 words."""
25
 
26
  def respond(
27
  message,
 
31
  temperature,
32
  top_p,
33
  ):
34
+ messages = [{"role": "system", "content": system_message},
35
+ {"role": "assistant", "content":"Welcome to the interview. I want to write a short biography about you and need some input from your side. Can you please start by stating your name and talking about your early childhood?"}]
36
 
37
  for val in history:
38
  if val[0]:
 
63
  demo = gr.ChatInterface(
64
  respond,
65
  additional_inputs=[
66
+ gr.Textbox(value=_sys_msg, label="System message"),
67
+ gr.Slider(minimum=1, maximum=2048, value=1024, step=1, label="Max new tokens"),
68
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
69
  gr.Slider(
70
  minimum=0.1,