Spaces:
Runtime error
Runtime error
ffreemt
commited on
Commit
·
d82d66e
1
Parent(s):
c3834f3
app.py
CHANGED
|
@@ -44,7 +44,7 @@ if has_cuda:
|
|
| 44 |
else:
|
| 45 |
model = AutoModel.from_pretrained(
|
| 46 |
model_name, trust_remote_code=True
|
| 47 |
-
).half().float() # .float() .half().float():
|
| 48 |
|
| 49 |
model = model.eval()
|
| 50 |
logger.debug("done load")
|
|
@@ -76,12 +76,12 @@ with gr.Blocks(theme=theme) as block:
|
|
| 76 |
with gr.Column(scale=12):
|
| 77 |
msg = gr.Textbox()
|
| 78 |
with gr.Column(scale=1, min_width=16):
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
|
| 83 |
# do not clear prompt
|
| 84 |
-
|
| 85 |
|
| 86 |
btn.click(respond, [msg, chatbot], [msg, chatbot])
|
| 87 |
|
|
|
|
| 44 |
else:
|
| 45 |
model = AutoModel.from_pretrained(
|
| 46 |
model_name, trust_remote_code=True
|
| 47 |
+
).half().float() # .float() .half().float(): must use float for cpu
|
| 48 |
|
| 49 |
model = model.eval()
|
| 50 |
logger.debug("done load")
|
|
|
|
| 76 |
with gr.Column(scale=12):
|
| 77 |
msg = gr.Textbox()
|
| 78 |
with gr.Column(scale=1, min_width=16):
|
| 79 |
+
with gr.Row():
|
| 80 |
+
btn = gr.Button("Send")
|
| 81 |
+
clear = gr.ClearButton([msg, chatbot])
|
| 82 |
|
| 83 |
# do not clear prompt
|
| 84 |
+
msg.submit(lambda x, y: [x] + respond(x, y)[1:], [msg, chatbot], [msg, chatbot])
|
| 85 |
|
| 86 |
btn.click(respond, [msg, chatbot], [msg, chatbot])
|
| 87 |
|