Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -123,9 +123,9 @@ def extract_arguments(text, temperature=0.01):
|
|
| 123 |
# Validate temperature
|
| 124 |
try:
|
| 125 |
temperature = float(temperature)
|
| 126 |
-
temperature = max(0.
|
| 127 |
except:
|
| 128 |
-
temperature = 0.
|
| 129 |
|
| 130 |
# Generate with the same parameters as local version
|
| 131 |
with torch.no_grad():
|
|
@@ -158,7 +158,7 @@ demo = gr.Interface(
|
|
| 158 |
fn=extract_arguments,
|
| 159 |
inputs=[
|
| 160 |
gr.Textbox(label="Input Text", placeholder="Enter newspaper text here...", lines=10),
|
| 161 |
-
gr.Slider(minimum=0.01, maximum=0.3, value=0.
|
| 162 |
],
|
| 163 |
outputs=[
|
| 164 |
gr.Textbox(label="Raw XML Output", lines=8)
|
|
@@ -166,8 +166,8 @@ demo = gr.Interface(
|
|
| 166 |
title="Newspaper Argumentative Unit Extractor",
|
| 167 |
description="Extract argumentative units from news sources",
|
| 168 |
examples=[
|
| 169 |
-
["Reggio, January 8. Frequent shocks of earthquake were felt here dur ing the night, accompanied at times by loud subter ranean reports. A few buildings that had not been completely destroyed were further damaged. The work of reconstructing the railway is being pushed forward energetically. News has been received from Brancaleone, Catanzaro, and Palmi of earthquakes by which the inhabitants were alarmed last night", 0.
|
| 170 |
-
["REBUILDING MESSINA. Now that Messina and Reggio are being rebuilt, the Red Cross Society of Switzeralnd has started an interesting experiment. It has sent to Sicilv to be used in rebuilding the towns, 60 chalets similar to those in use on the Alps. They are of two kinds: the one, destined for Messina, having one upper storv, while the other, to be erected in the country towns of Calabria, are of the bungalow tvpie. It is hoped that these wooden constructions will better resist the earth shocks than stone buildings, and in any case, should they fall, the casualties would be far fewer. Viewed iorm outside the chalets, which are much admired by the Sicilians, are exactly the same as those in the Alps: but the disposition or the interior has been modified somewhat to meet the needs of Italian life and a southern clime", 0.
|
| 171 |
]
|
| 172 |
)
|
| 173 |
|
|
|
|
| 123 |
# Validate temperature
|
| 124 |
try:
|
| 125 |
temperature = float(temperature)
|
| 126 |
+
temperature = max(0.05, min(0.3, temperature))
|
| 127 |
except:
|
| 128 |
+
temperature = 0.05
|
| 129 |
|
| 130 |
# Generate with the same parameters as local version
|
| 131 |
with torch.no_grad():
|
|
|
|
| 158 |
fn=extract_arguments,
|
| 159 |
inputs=[
|
| 160 |
gr.Textbox(label="Input Text", placeholder="Enter newspaper text here...", lines=10),
|
| 161 |
+
gr.Slider(minimum=0.01, maximum=0.3, value=0.05, step=0.05, label="Temperature (lower = more consistent)")
|
| 162 |
],
|
| 163 |
outputs=[
|
| 164 |
gr.Textbox(label="Raw XML Output", lines=8)
|
|
|
|
| 166 |
title="Newspaper Argumentative Unit Extractor",
|
| 167 |
description="Extract argumentative units from news sources",
|
| 168 |
examples=[
|
| 169 |
+
["Reggio, January 8. Frequent shocks of earthquake were felt here dur ing the night, accompanied at times by loud subter ranean reports. A few buildings that had not been completely destroyed were further damaged. The work of reconstructing the railway is being pushed forward energetically. News has been received from Brancaleone, Catanzaro, and Palmi of earthquakes by which the inhabitants were alarmed last night", 0.05],
|
| 170 |
+
["REBUILDING MESSINA. Now that Messina and Reggio are being rebuilt, the Red Cross Society of Switzeralnd has started an interesting experiment. It has sent to Sicilv to be used in rebuilding the towns, 60 chalets similar to those in use on the Alps. They are of two kinds: the one, destined for Messina, having one upper storv, while the other, to be erected in the country towns of Calabria, are of the bungalow tvpie. It is hoped that these wooden constructions will better resist the earth shocks than stone buildings, and in any case, should they fall, the casualties would be far fewer. Viewed iorm outside the chalets, which are much admired by the Sicilians, are exactly the same as those in the Alps: but the disposition or the interior has been modified somewhat to meet the needs of Italian life and a southern clime", 0.05]
|
| 171 |
]
|
| 172 |
)
|
| 173 |
|