Spaces:
Sleeping
Sleeping
A-Duss
commited on
Commit
•
c8cbb2b
1
Parent(s):
88abc31
keep 4 significative numbers
Browse files
app.py
CHANGED
@@ -4,25 +4,17 @@ from shitsu import ShitsuScorer
|
|
4 |
scorer = ShitsuScorer('en')
|
5 |
|
6 |
example_inputs = [
|
7 |
-
"Photosynthesis is the process by which green plants and some other organisms use sunlight to synthesize foods with the help of chlorophyll. It involves the intake of carbon dioxide and water and produces glucose and oxygen as by-products.",
|
8 |
-
"Hey, how was your day? Did you manage to finish that project you were working on?",
|
9 |
-
"In economics, the law of supply and demand describes the relationship between the availability of a particular product and the desire for that product. When supply increases, prices tend to drop, and when demand increases, prices tend to rise.",
|
10 |
-
"The Pythagorean theorem is a fundamental relation in Euclidean geometry among the three sides of a right triangle. It states that the square of the hypotenuse is equal to the sum of the squares of the other two sides.",
|
11 |
-
"Hey, do you want to grab coffee later? There's a new café that opened downtown.",
|
12 |
-
"Newton's second law of motion states that the acceleration of an object is directly proportional to the net force acting on the object and inversely proportional to the object's mass. The formula for this is F = ma.",
|
13 |
"The Beatles were a popular band in the 1960s. They released many hit songs.",
|
14 |
-
"In computer science, an algorithm is a finite sequence of well-defined instructions, typically used to solve a class of problems or perform a computation. Algorithms are essential to the functioning of modern software systems.",
|
15 |
"Chocolate is a type of sweet food that people often eat for dessert.",
|
16 |
"I'm thinking of going to the beach this weekend. The weather is supposed to be great!",
|
17 |
"Quantum mechanics is a fundamental theory in physics that provides a description of the physical properties of nature at the scale of atoms and subatomic particles.",
|
18 |
-
"I saw a great movie last night. You should check it out if you get a chance.",
|
19 |
-
"The mitochondrion is known as the powerhouse of the cell because it generates most of the cell's supply of adenosine triphosphate (ATP), used as a source of chemical energy.",
|
20 |
"Can you believe it's already September? This year is flying by!"
|
21 |
]
|
22 |
|
23 |
def get_score(user_text):
|
24 |
score = scorer.score([user_text])[0]
|
25 |
-
|
|
|
26 |
|
27 |
#language_options = ['am', 'ar', 'bg', 'bn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gu', 'ha', 'hi', 'hu', 'id', 'it', 'ja', 'jv', 'kn', 'ko', 'lt', 'mr', 'nl', 'no', 'yo', 'zh']
|
28 |
#https://huggingface.co/spaces/Dusduo/shitsu-text-scorer-demo/shitsu-logo.jpeg
|
@@ -32,7 +24,6 @@ css = '''
|
|
32 |
#title h1{font-size: 3em; display:inline-flex; align-items:center}
|
33 |
#title img{width: 100px; margin-right: 0.5em}
|
34 |
#gallery .grid-wrap{height: 10vh}
|
35 |
-
#lora_list{background: var(--block-background-fill);padding: 0 1em .3em; font-size: 90%}
|
36 |
.card_internal{display: flex;height: 100px;margin-top: .5em}
|
37 |
.card_internal img{margin-right: 1em}
|
38 |
.styler{--form-gap-width: 0px !important}
|
@@ -58,7 +49,7 @@ theme = gr.themes.Soft(
|
|
58 |
with gr.Blocks(theme=theme, css=css) as demo:
|
59 |
|
60 |
title = gr.HTML(
|
61 |
-
"""<h1><img src="
|
62 |
elem_id="title",
|
63 |
)
|
64 |
gr.Markdown(
|
|
|
4 |
scorer = ShitsuScorer('en')
|
5 |
|
6 |
example_inputs = [
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
"The Beatles were a popular band in the 1960s. They released many hit songs.",
|
|
|
8 |
"Chocolate is a type of sweet food that people often eat for dessert.",
|
9 |
"I'm thinking of going to the beach this weekend. The weather is supposed to be great!",
|
10 |
"Quantum mechanics is a fundamental theory in physics that provides a description of the physical properties of nature at the scale of atoms and subatomic particles.",
|
|
|
|
|
11 |
"Can you believe it's already September? This year is flying by!"
|
12 |
]
|
13 |
|
14 |
def get_score(user_text):
|
15 |
score = scorer.score([user_text])[0]
|
16 |
+
formatted_score = f"{score:.4g}"
|
17 |
+
yield f'<div class="nice-box"> Score: {formatted_score}</div>'
|
18 |
|
19 |
#language_options = ['am', 'ar', 'bg', 'bn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gu', 'ha', 'hi', 'hu', 'id', 'it', 'ja', 'jv', 'kn', 'ko', 'lt', 'mr', 'nl', 'no', 'yo', 'zh']
|
20 |
#https://huggingface.co/spaces/Dusduo/shitsu-text-scorer-demo/shitsu-logo.jpeg
|
|
|
24 |
#title h1{font-size: 3em; display:inline-flex; align-items:center}
|
25 |
#title img{width: 100px; margin-right: 0.5em}
|
26 |
#gallery .grid-wrap{height: 10vh}
|
|
|
27 |
.card_internal{display: flex;height: 100px;margin-top: .5em}
|
28 |
.card_internal img{margin-right: 1em}
|
29 |
.styler{--form-gap-width: 0px !important}
|
|
|
49 |
with gr.Blocks(theme=theme, css=css) as demo:
|
50 |
|
51 |
title = gr.HTML(
|
52 |
+
"""<h1><img src="/shitsu-logo.jpeg" alt="LightBlue"> Shitsu Text Scorer</h1>""",
|
53 |
elem_id="title",
|
54 |
)
|
55 |
gr.Markdown(
|