zkmine commited on
Commit
e19bb94
·
verified ·
1 Parent(s): 4358773

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -39
app.py CHANGED
@@ -260,49 +260,63 @@ HERO_HTML = """
260
  """
261
 
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  def build_app() -> gr.Blocks:
264
- """Construct the Gradio Blocks interface."""
265
- #with gr.Blocks(css=CUSTOM_CSS, title="PlainScript — Medical Rewriter") as app:
266
- with gr.Blocks(title="PlainScript — Medical Rewriter") as app:
267
- gr.HTML(STICKERS_HTML)
268
- gr.HTML(HERO_HTML)
269
-
270
- with gr.Row():
271
- input_text = gr.Textbox(
272
- label="Medical text",
273
- placeholder="Paste a medical abstract or clinical summary here…",
274
- lines=6,
275
- elem_id="input_box",
276
- )
277
-
278
- go_btn = gr.Button("Rewrite it", variant="primary", elem_id="go_btn")
279
-
280
- with gr.Row():
281
- before_box = gr.Textbox(
282
- label="Before · base Qwen2-1.5B",
283
- lines=9,
284
- interactive=False,
285
- elem_id="before_box",
286
- )
287
- after_box = gr.Textbox(
288
- label="After · fine-tuned on Cochrane",
289
- lines=9,
290
- interactive=False,
291
- elem_id="after_box",
292
- )
293
-
294
- #gr.Examples(examples=[[e] for e in EXAMPLES], inputs=input_text, label="Try an example")
295
-
296
- gr.HTML(
297
- '<div class="disclaimer">Drafts for review only — not medical '
298
- "advice. Outputs may contain errors and must be checked by a "
299
- "qualified professional before any patient-facing use.</div>"
300
  )
301
-
 
 
302
  go_btn.click(fn=rewrite, inputs=input_text, outputs=[before_box, after_box])
303
-
304
  return app
305
 
306
  demo = build_app()
307
- demo.launch(server_name="0.0.0.0", server_port=7860, share=True)
308
  #demo.launch(server_name="0.0.0.0", server_port=7860, share=False)
 
260
  """
261
 
262
 
263
+ # def build_app() -> gr.Blocks:
264
+ # """Construct the Gradio Blocks interface."""
265
+ # #with gr.Blocks(css=CUSTOM_CSS, title="PlainScript — Medical Rewriter") as app:
266
+ # with gr.Blocks(title="PlainScript — Medical Rewriter") as app:
267
+ # gr.HTML(STICKERS_HTML)
268
+ # gr.HTML(HERO_HTML)
269
+
270
+ # with gr.Row():
271
+ # input_text = gr.Textbox(
272
+ # label="Medical text",
273
+ # placeholder="Paste a medical abstract or clinical summary here…",
274
+ # lines=6,
275
+ # elem_id="input_box",
276
+ # )
277
+
278
+ # go_btn = gr.Button("Rewrite it", variant="primary", elem_id="go_btn")
279
+
280
+ # with gr.Row():
281
+ # before_box = gr.Textbox(
282
+ # label="Before · base Qwen2-1.5B",
283
+ # lines=9,
284
+ # interactive=False,
285
+ # elem_id="before_box",
286
+ # )
287
+ # after_box = gr.Textbox(
288
+ # label="After · fine-tuned on Cochrane",
289
+ # lines=9,
290
+ # interactive=False,
291
+ # elem_id="after_box",
292
+ # )
293
+
294
+ # #gr.Examples(examples=[[e] for e in EXAMPLES], inputs=input_text, label="Try an example")
295
+
296
+ # gr.HTML(
297
+ # '<div class="disclaimer">Drafts for review only — not medical '
298
+ # "advice. Outputs may contain errors and must be checked by a "
299
+ # "qualified professional before any patient-facing use.</div>"
300
+ # )
301
+
302
+ # go_btn.click(fn=rewrite, inputs=input_text, outputs=[before_box, after_box])
303
+
304
+ # return app
305
+
306
  def build_app() -> gr.Blocks:
307
+ with gr.Blocks(title="PlainScript") as app:
308
+ gr.Markdown("## PlainScript — Medical Rewriter")
309
+ input_text = gr.Textbox(
310
+ label="Medical text",
311
+ placeholder="Paste a medical abstract here…",
312
+ lines=6,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  )
314
+ go_btn = gr.Button("Rewrite it")
315
+ before_box = gr.Textbox(label="Before (base)", lines=9, interactive=False)
316
+ after_box = gr.Textbox(label="After (fine-tuned)", lines=9, interactive=False)
317
  go_btn.click(fn=rewrite, inputs=input_text, outputs=[before_box, after_box])
 
318
  return app
319
 
320
  demo = build_app()
321
+ demo.launch(server_name="0.0.0.0", server_port=7860)
322
  #demo.launch(server_name="0.0.0.0", server_port=7860, share=False)