aifeifei798 commited on
Commit
d1e3414
1 Parent(s): 98f824a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -21
app.py CHANGED
@@ -75,31 +75,11 @@ def run_example(image):
75
  return modify_caption(parsed_answer["<DESCRIPTION>"])
76
 
77
 
78
- css = """
79
- #output {
80
- height: 500px;
81
- overflow: auto;
82
- border: 1px solid #ccc;
83
- }
84
- #col-container {
85
- margin: 0 auto;
86
- max-width: 100%; /* 确保容器宽度不超过父元素 */
87
- display: flex; /* 使用 flexbox 布局 */
88
- justify-content: center; /* 水平居中 */
89
- align-items: center; /* 垂直居中 */
90
- }
91
- #col-container img {
92
- max-width: 100%; /* 图像宽度不超过容器 */
93
- max-height: 100%; /* 图像高度不超过容器 */
94
- object-fit: contain; /* 保持图像比例,完全显示图像 */
95
- }
96
- """
97
-
98
  with gr.Blocks(css=css) as demo:
99
  gr.Markdown(TITLE)
100
- input_img = gr.Image(elem_id="col-container", height="auto", label="Input Picture")
101
  submit_btn = gr.Button(value="Submit")
102
  output_text = gr.Textbox(label="Output Text")
 
103
  submit_btn.click(run_example, [input_img], [output_text])
104
 
105
  demo.launch(debug=True)
 
75
  return modify_caption(parsed_answer["<DESCRIPTION>"])
76
 
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  with gr.Blocks(css=css) as demo:
79
  gr.Markdown(TITLE)
 
80
  submit_btn = gr.Button(value="Submit")
81
  output_text = gr.Textbox(label="Output Text")
82
+ input_img = gr.Image(label="Input Picture")
83
  submit_btn.click(run_example, [input_img], [output_text])
84
 
85
  demo.launch(debug=True)