Spaces:
Runtime error
Runtime error
Add blocks
Browse files
app.py
CHANGED
|
@@ -19,55 +19,41 @@ def greet(name, length, function_words, grade_level, sarcasm, formality, voice,
|
|
| 19 |
def set_slider_value():
|
| 20 |
return 0.5
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
button
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
value="The quick brown fox jumped over the lazy dogs."
|
| 61 |
-
), # Text input for the name
|
| 62 |
-
gr.components.Markdown(
|
| 63 |
-
"# 2) Style Element Sliders\n### Adjust the style element sliders to the desired levels to steer the obfuscation."
|
| 64 |
-
), # Markdown as a header for sliders
|
| 65 |
-
] + sliders,
|
| 66 |
-
outputs=gr.Textbox(label="Output")
|
| 67 |
-
)
|
| 68 |
-
|
| 69 |
-
# Add the button to the interface
|
| 70 |
-
demo.add_component(button)
|
| 71 |
-
|
| 72 |
-
# Launch the Gradio interface
|
| 73 |
-
demo.launch()
|
|
|
|
| 19 |
def set_slider_value():
|
| 20 |
return 0.5
|
| 21 |
|
| 22 |
+
with gr.Blocks() as demo:
|
| 23 |
+
gr.Markdown("# 1) Input Text\n### Enter the text to be obfuscated.")
|
| 24 |
+
name = gr.Textbox(label="Input Text", value="The quick brown fox jumped over the lazy dogs.")
|
| 25 |
+
gr.Markdown("# 2) Style Element Sliders\n### Adjust the style element sliders to the desired levels to steer the obfuscation.")
|
| 26 |
+
|
| 27 |
+
length_slider = gr.Slider(label="Length (Shorter \u2192 Longer)", minimum=-1, maximum=1, step=0.01, value=0)
|
| 28 |
+
function_words_slider = gr.Slider(label="Function Words (Fewer \u2192 More)", minimum=-1, maximum=1, step=0.01, value=0)
|
| 29 |
+
grade_level_slider = gr.Slider(label="Grade Level (Lower \u2192 Higher)", minimum=-1, maximum=1, step=0.01, value=0)
|
| 30 |
+
formality_slider = gr.Slider(label="Formality (Less \u2192 More)", minimum=-1, maximum=1, step=0.01, value=0)
|
| 31 |
+
sarcasm_slider = gr.Slider(label="Sarcasm (Less * \u2192 More)", minimum=-1, maximum=1, step=0.01, value=0)
|
| 32 |
+
voice_slider = gr.Slider(label="Voice (Passive * \u2192 Active)", minimum=-1, maximum=1, step=0.01, value=0)
|
| 33 |
+
persuasive_slider = gr.Slider(label="Writing Type: Persuasive (None \u2192 More)", minimum=0, maximum=1, step=0.01, value=0)
|
| 34 |
+
descriptive_slider = gr.Slider(label="Writing Type: Descriptive (None \u2192 More)", minimum=0, maximum=1, step=0.01, value=0)
|
| 35 |
+
narrative_slider = gr.Slider(label="Writing Type: Narrative (None \u2192 More)", minimum=0, maximum=1, step=0.01, value=0)
|
| 36 |
+
expository_slider = gr.Slider(label="Writing Type: Expository (None \u2192 More)", minimum=0, maximum=1, step=0.01, value=0)
|
| 37 |
+
|
| 38 |
+
sliders = [
|
| 39 |
+
length_slider,
|
| 40 |
+
function_words_slider,
|
| 41 |
+
grade_level_slider,
|
| 42 |
+
formality_slider,
|
| 43 |
+
sarcasm_slider,
|
| 44 |
+
voice_slider,
|
| 45 |
+
persuasive_slider,
|
| 46 |
+
descriptive_slider,
|
| 47 |
+
narrative_slider,
|
| 48 |
+
expository_slider
|
| 49 |
+
]
|
| 50 |
+
|
| 51 |
+
button = gr.Button("Set Sliders to 0.5")
|
| 52 |
+
|
| 53 |
+
button.click(fn=set_slider_value, outputs=sliders)
|
| 54 |
+
|
| 55 |
+
output = gr.Textbox(label="Output")
|
| 56 |
+
|
| 57 |
+
demo.add(name, *sliders, button, output)
|
| 58 |
+
|
| 59 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|