update
Browse files- aimodel.py +2 -1
- app.py +14 -0
aimodel.py
CHANGED
@@ -18,7 +18,8 @@ class Florence:
|
|
18 |
return
|
19 |
self.model = (
|
20 |
AutoModelForCausalLM.from_pretrained(
|
21 |
-
model_id, trust_remote_code=True, torch_dtype="auto"
|
|
|
22 |
)
|
23 |
.eval()
|
24 |
.cuda()
|
|
|
18 |
return
|
19 |
self.model = (
|
20 |
AutoModelForCausalLM.from_pretrained(
|
21 |
+
model_id, trust_remote_code=True, torch_dtype="auto",
|
22 |
+
trust_remote_code=True
|
23 |
)
|
24 |
.eval()
|
25 |
.cuda()
|
app.py
CHANGED
@@ -49,6 +49,20 @@ with gr.Blocks() as demo:
|
|
49 |
number_output = gr.Textbox(label="辨識結果", placeholder="辨識結果")
|
50 |
image_output = gr.Image(label="輸出圖片")
|
51 |
plot_output = gr.Image(label="模型結果")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
clear_button.add([image_input, image_output, number_output])
|
54 |
|
|
|
49 |
number_output = gr.Textbox(label="辨識結果", placeholder="辨識結果")
|
50 |
image_output = gr.Image(label="輸出圖片")
|
51 |
plot_output = gr.Image(label="模型結果")
|
52 |
+
gr.Examples(
|
53 |
+
examples=[
|
54 |
+
['images/img1.jpg', '圓形儀表'],
|
55 |
+
['images/img2.jpg', '圓形儀表'],
|
56 |
+
['images/img3.jpg', '圓形儀表'],
|
57 |
+
['images/img4.jpg', '圓形儀表'],
|
58 |
+
['images/img5.jpg', '方形儀表'],
|
59 |
+
],
|
60 |
+
inputs=[image_input, meter_type_dropdown],
|
61 |
+
outputs=[image_output, number_output, plot_output],
|
62 |
+
fn=process_image,
|
63 |
+
cache_examples=True,
|
64 |
+
label="Examples"
|
65 |
+
)
|
66 |
|
67 |
clear_button.add([image_input, image_output, number_output])
|
68 |
|