DYDYLAN commited on
Commit
f01d54f
·
verified ·
1 Parent(s): 7f2cc83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -37
app.py CHANGED
@@ -128,52 +128,39 @@ Paragraph:
128
 
129
  # ===================== 4. Gradio UI(宽文本框 + 全宽布局) =====================
130
 
131
- with gr.Blocks(css="""
132
- .wide_textbox textarea {
133
- font-size: 15px !important;
134
- line-height: 1.5 !important;
135
- width: 100% !important;
136
- min-height: 140px !important;
137
- }
138
- """) as demo:
139
-
140
- gr.Markdown("# **ChartSmith – AI 论文图表生成助手(支持上传论文 PDF)**")
141
 
142
  with gr.Row():
143
- with gr.Column(scale=1):
144
- img_in = gr.Image(type="pil", label="上传你的学术图表")
145
- paper_file = gr.File(label="上传论文 PDF(可选)", file_types=[".pdf"])
146
- language = gr.Radio(["English", "中文"], value="English", label="输出语言")
147
- btn = gr.Button("分析并美化图表", variant="primary")
148
-
149
- with gr.Column(scale=1.2):
150
- orig_img = gr.Image(label="原始图表")
151
 
152
- raw_caption_box = gr.Textbox(
153
- label="Step 2: 初步自动描述(Vision-LLM)",
154
- lines=4,
155
- elem_classes=["wide_textbox"]
156
  )
157
 
158
- academic_box = gr.Textbox(
159
- label="Step 3: 学术化解释(结合论上下文)",
160
- lines=6,
161
- elem_classes=["wide_textbox"]
162
  )
163
 
164
- enhanced_img = gr.Image(label="Step 4: 增强后图示(对比度+亮度)")
165
-
166
- caption_box = gr.Textbox(
167
- label="Step 5: 自动生成图注(Caption)",
168
- lines=4,
169
- elem_classes=["wide_textbox"]
170
  )
171
 
172
- summary_box = gr.Textbox(
173
- label="Step 5: 图表摘要 / 讨论",
174
- lines=6,
175
- elem_classes=["wide_textbox"]
176
- )
 
 
 
 
177
 
178
  btn.click(
179
  analyze_and_enhance,
 
128
 
129
  # ===================== 4. Gradio UI(宽文本框 + 全宽布局) =====================
130
 
131
+ with gr.Blocks() as demo:
132
+ gr.Markdown("# ChartSmith – AI 论文图表生成助手")
 
 
 
 
 
 
 
 
133
 
134
  with gr.Row():
135
+ with gr.Column():
136
+ img_in = gr.Image(type="pil", label="上传你的学术图表(截图也可以)")
 
 
 
 
 
 
137
 
138
+ style = gr.Dropdown(
139
+ ["Formal academic", "Infographic", "Magazine-style"],
140
+ value="Formal academic",
141
+ label="重绘风格"
142
  )
143
 
144
+ language = gr.Radio(
145
+ ["English", "中文"],
146
+ value="English",
147
+ label="输出语言"
148
  )
149
 
150
+ paper_file = gr.File(
151
+ label="上传相关论文(可选,用于更精准解释)",
152
+ file_types=[".txt", ".pdf", ".md"]
 
 
 
153
  )
154
 
155
+ btn = gr.Button("分析并美化图表")
156
+
157
+ with gr.Column():
158
+ orig_img = gr.Image(label="原始图表")
159
+ raw_caption_box = gr.Textbox(label="Step 2: 初步自动描述(Vision-LLM)", lines=4)
160
+ academic_box = gr.Textbox(label="Step 3: 学术化解释(结合论文上下文)", lines=6)
161
+ enhanced_img = gr.Image(label="Step 4: 强化后的图表(亮度/对比度提升)")
162
+ caption_box = gr.Textbox(label="Step 5: 自动生成图注(Caption)", lines=4)
163
+ summary_box = gr.Textbox(label="Step 5: 图表简短摘要 / 讨论", lines=6)
164
 
165
  btn.click(
166
  analyze_and_enhance,