LeaBresson commited on
Commit
30777b7
1 Parent(s): c08659e

Add app file

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+
4
+ title = "🪶 PubMed Summarization Tool"
5
+
6
+ description = '<p style="text-align:center;"><img src="https://dynomapper.com/images/Google_Search_Console_for_Seo_banner_4.jpg"></p>'
7
+
8
+ article = "<p style='text-align: center'> ℹ️ This model is fine-tuned using Autotrain on 3000 PubMed summaries</p>"
9
+
10
+ textbox = gr.Textbox(label="Text to be summarized", lines=2)
11
+
12
+ text1 = """
13
+ Screening exams find disease before symptoms begin. The goal of screening is to detect disease at its earliest and most treatable stage.
14
+ In order to be widely accepted and recommended by medical practitioners, a screening program must meet a number of criteria, including reducing
15
+ the number of deaths from the given disease.
16
+ Screening tests may include lab tests that check blood and other fluids, genetic tests that look for inherited genetic markers linked to disease,
17
+ and imaging exams that produce pictures of the inside of the body. These tests are typically available to the general population.
18
+ However, an individual's needs for a specific screening test are based on factors such as age, gender, and family history.
19
+ """
20
+
21
+ text2 = """
22
+ Low-dose aspirin helps to prevent heart attacks and strokes in people who are at high risk of them. Aspirin is also known as acetylsalicylic
23
+ acid. Your doctor may suggest that you take a daily low dose if you have had a stroke or a heart attack to help stop you having another one.
24
+ Or, if you're at high risk of heart attack – for example, if you have had heart surgery or if you have chest pain (angina) caused by heart disease.
25
+ If you’re pregnant, you may be recommended to take low-dose aspirin if:
26
+ you’re at risk of high blood pressure (pre-eclampsia)
27
+ you have underlying medical conditions where you have been advised to take low dose aspirin
28
+ you have had several miscarriages or complications in a previous pregnancy
29
+ Only take daily low-dose aspirin if your doctor recommends it. Low-dose aspirin comes as tablets, including tablets that dissolve in a drink of
30
+ water (soluble) and tablets with a special coating (enteric coated/gastro-resistant) to help to protect your stomach.
31
+ It's available on prescription. You can also buy it from pharmacies. However, if you’re pregnant, or having fertility treatment, low-dose aspirin
32
+ will need to be prescribed by your doctor, a pregnancy specialist (obstetrician) or a midwife.
33
+ Children are sometimes treated with low-dose aspirin after heart surgery or to treat a rare condition called Kawasaki disease.
34
+ Children should only take low-dose aspirin if a doctor prescribes it.
35
+ Taking low-dose aspirin to prevent heart attacks and strokes is not the same as taking aspirin for pain relief.
36
+ """
37
+
38
+ gr.Interface.load("models/LeaBresson/autotrain-summarization-pubmed-sample-3609596599",
39
+ inputs=textbox,
40
+ outputs="text",
41
+ title=title,
42
+ description=description,
43
+ article=article,
44
+ examples=[[text1], [text2]],
45
+ ).launch()