Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -123,6 +123,25 @@ def generate_response(image, question):
|
|
| 123 |
|
| 124 |
return response
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
title = "🇻🇳 Vietnamese Image Captioning"
|
| 127 |
description = "Tải lên một bức ảnh và mô hình sẽ sinh mô tả tiếng Việt tương ứng."
|
| 128 |
|
|
@@ -137,23 +156,6 @@ demo = gr.Interface(
|
|
| 137 |
if __name__ == "__main__":
|
| 138 |
demo.launch()
|
| 139 |
|
| 140 |
-
# # Create Gradio interface
|
| 141 |
-
# with gr.Blocks() as demo:
|
| 142 |
-
# gr.Markdown("# Vintern-1B-v3.5 Demo")
|
| 143 |
-
# gr.Markdown("Tải lên hình ảnh và đặt câu hỏi (hoặc để trống để trích xuất thông tin).")
|
| 144 |
-
|
| 145 |
-
# with gr.Row():
|
| 146 |
-
# with gr.Column():
|
| 147 |
-
# image_input = gr.Image(type="pil", label="Hình ảnh")
|
| 148 |
-
# question_input = gr.Textbox(
|
| 149 |
-
# placeholder="<image>\nTrích xuất thông tin chính trong ảnh và trả về dạng markdown.",
|
| 150 |
-
# label="Câu hỏi (để trống để trích xuất thông tin)"
|
| 151 |
-
# )
|
| 152 |
-
# submit_btn = gr.Button("Gửi")
|
| 153 |
-
|
| 154 |
-
# with gr.Column():
|
| 155 |
-
# output = gr.Markdown(label="Kết quả")
|
| 156 |
-
|
| 157 |
# submit_btn.click(
|
| 158 |
# fn=generate_response,
|
| 159 |
# inputs=[image_input, question_input],
|
|
|
|
| 123 |
|
| 124 |
return response
|
| 125 |
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
# # Create Gradio interface
|
| 129 |
+
# with gr.Blocks() as demo:
|
| 130 |
+
gr.Markdown("# Vintern-1B-v3.5 Demo")
|
| 131 |
+
gr.Markdown("Tải lên hình ảnh và đặt câu hỏi (hoặc để trống để trích xuất thông tin).")
|
| 132 |
+
|
| 133 |
+
with gr.Row():
|
| 134 |
+
with gr.Column():
|
| 135 |
+
image_input = gr.Image(type="pil", label="Hình ảnh")
|
| 136 |
+
question_input = gr.Textbox(
|
| 137 |
+
placeholder="<image>\nTrích xuất thông tin chính trong ảnh và trả về dạng markdown.",
|
| 138 |
+
label="Câu hỏi (để trống để trích xuất thông tin)"
|
| 139 |
+
)
|
| 140 |
+
submit_btn = gr.Button("Gửi")
|
| 141 |
+
|
| 142 |
+
with gr.Column():
|
| 143 |
+
output = gr.Markdown(label="Kết quả")
|
| 144 |
+
|
| 145 |
title = "🇻🇳 Vietnamese Image Captioning"
|
| 146 |
description = "Tải lên một bức ảnh và mô hình sẽ sinh mô tả tiếng Việt tương ứng."
|
| 147 |
|
|
|
|
| 156 |
if __name__ == "__main__":
|
| 157 |
demo.launch()
|
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
# submit_btn.click(
|
| 160 |
# fn=generate_response,
|
| 161 |
# inputs=[image_input, question_input],
|