Update app.py
Browse files
app.py
CHANGED
@@ -9,13 +9,13 @@ classifier = pipeline("text-classification",
|
|
9 |
tokenizer=scibert_tokenizer)
|
10 |
|
11 |
|
12 |
-
title_1 = "
|
13 |
-
abstract_1 = "
|
14 |
-
text_1 = """
|
15 |
|
16 |
-
title_2 = "
|
17 |
-
abstract_2 = "
|
18 |
-
text_2 = """
|
19 |
|
20 |
class_map = {"LABEL_0": 'Biology 🦠🧬🦖',
|
21 |
"LABEL_1": 'Chemistry 👨🔬⚗️🔬',
|
@@ -27,15 +27,18 @@ class_map = {"LABEL_0": 'Biology 🦠🧬🦖',
|
|
27 |
['Biology', 'Chemistry', 'Computer Science', 'Medicine', 'Physics']
|
28 |
|
29 |
def predict(title:str, abstract: str, aricle_text):
|
30 |
-
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
output[label] = result["score"]
|
37 |
|
38 |
-
|
|
|
|
|
|
|
|
|
39 |
|
40 |
iface = gr.Interface(
|
41 |
fn=predict,
|
@@ -44,10 +47,10 @@ iface = gr.Interface(
|
|
44 |
gr.Textbox(lines=5, label="Article Text")],
|
45 |
outputs=gr.Label(num_top_classes=5),
|
46 |
examples=[[title_1, abstract_1, text_1], [title_2, abstract_2, text_2]],
|
47 |
-
|
48 |
description= "Upload the paper title, its abstract, and the beginning of the text. Our model will figure out whether this is a Biology, Chemistry, Computer Science, Medicine or Physics related article."
|
49 |
)
|
50 |
|
51 |
-
iface.launch()
|
52 |
|
53 |
|
|
|
9 |
tokenizer=scibert_tokenizer)
|
10 |
|
11 |
|
12 |
+
title_1 = "Depth Control Method of Profiling Float Based on an Improved Double PD Controller"
|
13 |
+
abstract_1 = "A kinematic equation of profiling float is nonlinear and has time-varying parameters. Traditional PD controllers not only demonstrate an inconsistent response to different depth controls but also face problems of overshooting and high power consumption. To realize the goal of depth control of profiling buoy under low power consumption, an improved double PD control method was proposed in this paper. The real-time prediction of position and low-power running of the sensor were realized through sparse sampling and depth prediction. The combination control over position, speed, and flow was realized by introducing the speed and flow expectation function. Then, a MATLAB/Simulink simulation model was constructed, and the proposed controller was compared with a single PD controller and an improved single PD controller. Among ten depth control tests, the proposed method was superior given its short response time, small overshooting, small steady-state error, and low power consumption. Moreover, it achieved a consistent control effect on different target depths. The simulation results demonstrated that a nonlinear and time-varying floating system controlled by the proposed method has favorable robustness and stability. This system will consume minimal power simultaneously."
|
14 |
+
text_1 = """ With the increase in the cognition of marine and accelerating ocean exploitation, research and development of submersible vehicles with large diving depth and long voyage has become a research hotspot [1] . Autonomous underwater vehicle (AUV) [2] , autonomous profile observation float (hereinafter referred to as ''float'') [3] , manned deep submersible vehicle, and underwater gliders have attracted considerable attention and have been studied extensively."""
|
15 |
|
16 |
+
title_2 = "Cosmography and Data Visualization"
|
17 |
+
abstract_2 = " Cosmography, the study and making of maps of the universe or cosmos, is a field where visual representation benefits from modern three-dimensional visualization techniques and media. At the extragalactic distance scales, visualization is contributing in understanding the complex structure of the local universe, in terms of spatial distribution and flows of galaxies and dark matter. In this paper, we report advances in the field of extragalactic cosmography obtained using the SDvision visualization software in the context of the Cosmicflows Project. Here, multiple visualization techniques are applied to a variety of data products: catalogs of galaxy positions and galaxy peculiar velocities, reconstructed velocity field, density field, gravitational potential field, velocity shear tensor viewed in terms of its eigenvalues and eigenvectors, envelope surfaces enclosing basins of attraction. These visualizations, implemented as high-resolution images, videos, and interactive viewers, have contributed to a number of studies: the cosmography of the local part of the universe, the nature of the Great Attractor, the discovery of the boundaries of our home supercluster of galaxies Laniakea, the mapping of the cosmic web, the study of attractors and repellers."
|
18 |
+
text_2 = """Throughout the ages, astronomers have strived to materialize their discoveries and understanding of the cosmos by the means of visualizations. The oldest known depiction of celestial objects, the Nebra sky disc, dates back from the Bronze age, 3600 years ago (Benson 2014) . While most of the astronomical representations are projections to two dimensional sketches and images, the introduction of the third dimension in depictive apparatuses has been sought by astronomers as an essential mean to promote understanding. Such objects as the armillary spheres, dating back from the Hellenistic world, or the modern era orreries used to mechanically model the solar system, played an important role in the history of astronomy. Today, computer-based interactive three-dimensional visualization techniques have become a fruitful research tool. Here, we present the impact of visualization on cosmography in the context of the Cosmicflows Project."""
|
19 |
|
20 |
class_map = {"LABEL_0": 'Biology 🦠🧬🦖',
|
21 |
"LABEL_1": 'Chemistry 👨🔬⚗️🔬',
|
|
|
27 |
['Biology', 'Chemistry', 'Computer Science', 'Medicine', 'Physics']
|
28 |
|
29 |
def predict(title:str, abstract: str, aricle_text):
|
30 |
+
output = {}
|
31 |
|
32 |
+
input_text = f"{title}\n {abstract}\n {aricle_text}"
|
33 |
|
34 |
+
results = classifier(input_text, top_k=None)
|
35 |
+
print(results)
|
|
|
36 |
|
37 |
+
for result in results:
|
38 |
+
label = class_map[result["label"]]
|
39 |
+
output[label] = result["score"]
|
40 |
+
|
41 |
+
return output
|
42 |
|
43 |
iface = gr.Interface(
|
44 |
fn=predict,
|
|
|
47 |
gr.Textbox(lines=5, label="Article Text")],
|
48 |
outputs=gr.Label(num_top_classes=5),
|
49 |
examples=[[title_1, abstract_1, text_1], [title_2, abstract_2, text_2]],
|
50 |
+
title="Article topic classifier",
|
51 |
description= "Upload the paper title, its abstract, and the beginning of the text. Our model will figure out whether this is a Biology, Chemistry, Computer Science, Medicine or Physics related article."
|
52 |
)
|
53 |
|
54 |
+
iface.launch(debug=True)
|
55 |
|
56 |
|