Spaces:
Runtime error
Runtime error
Mathias Lux commited on
Commit ·
cbc4f9f
1
Parent(s): c303f34
switched back and added label
Browse files
app.py
CHANGED
|
@@ -23,6 +23,11 @@ Always approach these questions with mindfulness. Focus on interesting aspects s
|
|
| 23 |
|
| 24 |
When prompted, summarize your interviewee's responses in a news article of about 2500 words."""
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
def respond(
|
| 27 |
message,
|
| 28 |
history: list[tuple[str, str]],
|
|
@@ -31,13 +36,9 @@ def respond(
|
|
| 31 |
temperature,
|
| 32 |
top_p,
|
| 33 |
):
|
| 34 |
-
messages = [{"role": "system", "content": system_message}
|
|
|
|
| 35 |
|
| 36 |
-
# Add initial system message if history is empty
|
| 37 |
-
if not history:
|
| 38 |
-
# history.append({"role": "system", "content": "Hello! I'm ready to assist you."})
|
| 39 |
-
history.append(None, "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?")
|
| 40 |
-
|
| 41 |
for val in history:
|
| 42 |
if val[0]:
|
| 43 |
messages.append({"role": "user", "content": val[0]})
|
|
@@ -66,6 +67,7 @@ def respond(
|
|
| 66 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 67 |
"""
|
| 68 |
demo = gr.ChatInterface(
|
|
|
|
| 69 |
respond,
|
| 70 |
additional_inputs=[
|
| 71 |
gr.Textbox(value=_sys_msg, label="System message"),
|
|
|
|
| 23 |
|
| 24 |
When prompted, summarize your interviewee's responses in a news article of about 2500 words."""
|
| 25 |
|
| 26 |
+
_ass_msg_start = """
|
| 27 |
+
Welcome to the interview. I want to write a short biography about you and need some input from your side.
|
| 28 |
+
Can you please start by stating your name and talking about your early childhood?
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
def respond(
|
| 32 |
message,
|
| 33 |
history: list[tuple[str, str]],
|
|
|
|
| 36 |
temperature,
|
| 37 |
top_p,
|
| 38 |
):
|
| 39 |
+
messages = [{"role": "system", "content": system_message},
|
| 40 |
+
{"role": "assistant", "content": _ass_msg_start}]
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
for val in history:
|
| 43 |
if val[0]:
|
| 44 |
messages.append({"role": "user", "content": val[0]})
|
|
|
|
| 67 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 68 |
"""
|
| 69 |
demo = gr.ChatInterface(
|
| 70 |
+
gr.HTML("<h1>Interviewer</h1>"),
|
| 71 |
respond,
|
| 72 |
additional_inputs=[
|
| 73 |
gr.Textbox(value=_sys_msg, label="System message"),
|