Spaces:
Sleeping
Sleeping
罗峰
commited on
Commit
·
580bff2
1
Parent(s):
db3ae8f
app commit
Browse files
app.py
CHANGED
@@ -71,14 +71,14 @@ def reset_user_input():
|
|
71 |
def reset_state():
|
72 |
return [], []
|
73 |
|
74 |
-
def predict(file,input,
|
75 |
input1=f""+input+"\n"+file
|
76 |
out=agent(input1)
|
77 |
-
anws=toChinese(out['output'])
|
78 |
-
chatbot.append(input)
|
79 |
-
chatbot[-1] = (input, anws)
|
80 |
-
yield chatbot, history
|
81 |
-
return
|
82 |
|
83 |
# with gr.Blocks(css=".chat-blocks{height:calc(100vh - 332px);} .mychat{flex:1} .mychat .block{min-height:100%} .mychat .block .wrap{max-height: calc(100vh - 330px);} .myinput{flex:initial !important;min-height:180px}") as demo:
|
84 |
# title = '图像识别'
|
@@ -100,7 +100,7 @@ def predict(file,input, chatbot,history):
|
|
100 |
# emptyBtn.click(reset_state, outputs=[chatbot, history], show_progress=True)
|
101 |
with gr.Blocks() as demo:
|
102 |
image_url = gr.Image(type="filepath",label="请选择一张图片")
|
103 |
-
input = gr.Textbox(label='
|
104 |
output = gr.Textbox(label='答案', placeholder="", lines=2,interactive=False)
|
105 |
submit = gr.Button('提问',variant="primary")
|
106 |
submit.click(predict,inputs=[image_url,input],outputs=output)
|
|
|
71 |
def reset_state():
|
72 |
return [], []
|
73 |
|
74 |
+
def predict(file,input,history):
|
75 |
input1=f""+input+"\n"+file
|
76 |
out=agent(input1)
|
77 |
+
anws = toChinese(out['output'])
|
78 |
+
# chatbot.append(input)
|
79 |
+
# chatbot[-1] = (input, anws)
|
80 |
+
# yield chatbot, history
|
81 |
+
return anws
|
82 |
|
83 |
# with gr.Blocks(css=".chat-blocks{height:calc(100vh - 332px);} .mychat{flex:1} .mychat .block{min-height:100%} .mychat .block .wrap{max-height: calc(100vh - 330px);} .myinput{flex:initial !important;min-height:180px}") as demo:
|
84 |
# title = '图像识别'
|
|
|
100 |
# emptyBtn.click(reset_state, outputs=[chatbot, history], show_progress=True)
|
101 |
with gr.Blocks() as demo:
|
102 |
image_url = gr.Image(type="filepath",label="请选择一张图片")
|
103 |
+
input = gr.Textbox(label='请描述您的问题', placeholder="", lines=1)
|
104 |
output = gr.Textbox(label='答案', placeholder="", lines=2,interactive=False)
|
105 |
submit = gr.Button('提问',variant="primary")
|
106 |
submit.click(predict,inputs=[image_url,input],outputs=output)
|