Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ def load_model():
|
|
31 |
def chat(inp, history, agent):
|
32 |
history = history or []
|
33 |
if agent is None:
|
34 |
-
history.append((inp, "Please
|
35 |
return history, history
|
36 |
print("\n==== date/time: " + str(datetime.datetime.now()) + " ====")
|
37 |
print("inp: " + inp)
|
@@ -49,11 +49,6 @@ with block:
|
|
49 |
with gr.Row():
|
50 |
gr.Markdown("<h3><center>🤗 Transformers Chat</center></h3><p>Ask questions about the Hugging Face Transformers Library, Powered by Flan-UL2</p>")
|
51 |
|
52 |
-
load_model_button = gr.Button(
|
53 |
-
value="Load Model",
|
54 |
-
variant="secondary"
|
55 |
-
).style(full_width=False)
|
56 |
-
|
57 |
chatbot = gr.Chatbot()
|
58 |
|
59 |
with gr.Row():
|
@@ -85,6 +80,8 @@ with block:
|
|
85 |
state = gr.State()
|
86 |
agent_state = gr.State()
|
87 |
|
|
|
|
|
88 |
submit.click(chat, inputs=[message, state, agent_state], outputs=[chatbot, state])
|
89 |
message.submit(chat, inputs=[message, state, agent_state], outputs=[chatbot, state])
|
90 |
|
|
|
31 |
def chat(inp, history, agent):
|
32 |
history = history or []
|
33 |
if agent is None:
|
34 |
+
history.append((inp, "Please wait for model to load (3-5 seconds)"))
|
35 |
return history, history
|
36 |
print("\n==== date/time: " + str(datetime.datetime.now()) + " ====")
|
37 |
print("inp: " + inp)
|
|
|
49 |
with gr.Row():
|
50 |
gr.Markdown("<h3><center>🤗 Transformers Chat</center></h3><p>Ask questions about the Hugging Face Transformers Library, Powered by Flan-UL2</p>")
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
chatbot = gr.Chatbot()
|
53 |
|
54 |
with gr.Row():
|
|
|
80 |
state = gr.State()
|
81 |
agent_state = gr.State()
|
82 |
|
83 |
+
block.load(load_model, inputs=None, outputs=[agent_state]
|
84 |
+
|
85 |
submit.click(chat, inputs=[message, state, agent_state], outputs=[chatbot, state])
|
86 |
message.submit(chat, inputs=[message, state, agent_state], outputs=[chatbot, state])
|
87 |
|