Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,22 +72,26 @@ def predict(message, history):
|
|
| 72 |
pprint(f"[Tokens={chunkCount}] {message}")
|
| 73 |
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
with gr.ChatInterface(
|
| 76 |
predict,
|
| 77 |
title="Business Advice from Jeff Bezos ",
|
| 78 |
-
theme=gr.themes.Soft(),
|
| 79 |
-
chatbot=
|
| 80 |
textbox=gr.Textbox(
|
| 81 |
placeholder="Hey, I am Jeff Bezos, Founder of Amazon",
|
| 82 |
-
# lines=2,
|
| 83 |
scale=7,
|
| 84 |
max_lines=2,
|
| 85 |
)
|
| 86 |
) as demo:
|
|
|
|
| 87 |
demo.load(__attachIp, None, None)
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
demo.launch(debug=True)
|
| 92 |
|
| 93 |
|
|
|
|
| 72 |
pprint(f"[Tokens={chunkCount}] {message}")
|
| 73 |
|
| 74 |
|
| 75 |
+
def initial_message():
|
| 76 |
+
return [("Hey, I am Jeff Bezos, Founder of Amazon. How can I help you today?", "")]
|
| 77 |
+
|
| 78 |
+
# Define the Chatbot component and store it in a variable
|
| 79 |
+
chatbot_component = gr.Chatbot(label="Business Advice from Jeff Bezos")
|
| 80 |
+
|
| 81 |
with gr.ChatInterface(
|
| 82 |
predict,
|
| 83 |
title="Business Advice from Jeff Bezos ",
|
| 84 |
+
theme=gr.themes.Soft(), # gr.themes.Default()
|
| 85 |
+
chatbot=chatbot_component,
|
| 86 |
textbox=gr.Textbox(
|
| 87 |
placeholder="Hey, I am Jeff Bezos, Founder of Amazon",
|
|
|
|
| 88 |
scale=7,
|
| 89 |
max_lines=2,
|
| 90 |
)
|
| 91 |
) as demo:
|
| 92 |
+
demo.load(initial_message, None, chatbot_component) # Pass the actual component here
|
| 93 |
demo.load(__attachIp, None, None)
|
| 94 |
|
|
|
|
|
|
|
| 95 |
demo.launch(debug=True)
|
| 96 |
|
| 97 |
|