minko186 commited on
Commit
c53fa23
·
verified ·
1 Parent(s): 9d1ac35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -3
app.py CHANGED
@@ -1,8 +1,65 @@
1
  import gradio as gr
 
2
 
3
  with gr.Blocks() as demo:
4
  gr.Markdown("# Polygraf Writer")
5
  with gr.Row():
6
- gr.Markdown("## Enter a topic to write an article about:")
7
- input_topic = gr.Textbox(label="Topic")
8
- gr.Markdown("### Humanized article:")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from humanize import paraphrase_text
3
 
4
  with gr.Blocks() as demo:
5
  gr.Markdown("# Polygraf Writer")
6
  with gr.Row():
7
+ with gr.Column(scale=0.7):
8
+ gr.Markdown("## Enter a topic to write an article about:")
9
+ input_topic = gr.Textbox(label="Topic")
10
+ gr.Markdown("### Humanized article:")
11
+ output_label = gr.HTML(label="Output")
12
+ model_dropdown = gr.Radio(
13
+ choices=[
14
+ "Base Model",
15
+ "Large Model",
16
+ "XL Model",
17
+ "XL Law Model",
18
+ "XL Marketing Model",
19
+ "XL Child Style Model",
20
+ ],
21
+ value="Large Model",
22
+ label="Select Model Version",
23
+ )
24
+ process_button = gr.Button("Humanize Text")
25
+
26
+ with gr.Column(scale=0.3):
27
+ temperature_slider = gr.Slider(minimum=0.5, maximum=2.0, step=0.1, value=1.2, label="Temperature")
28
+ gr.Markdown("Controls the randomness of the paraphrase. Higher values generate more varied text.")
29
+ top_k_slider = gr.Slider(
30
+ minimum=0,
31
+ maximum=300,
32
+ step=25,
33
+ value=50,
34
+ label="Top k",
35
+ )
36
+ gr.Markdown("Limits the number of top tokens considered during generation.")
37
+ repetition_penalty_slider = gr.Slider(
38
+ minimum=1.0,
39
+ maximum=2.0,
40
+ step=0.1,
41
+ value=1,
42
+ label="Repetition Penalty",
43
+ )
44
+ gr.Markdown("Penalizes repeated words to encourage diverse language use")
45
+ length_penalty_slider = gr.Slider(
46
+ minimum=0.0,
47
+ maximum=2.0,
48
+ step=0.1,
49
+ value=1.0,
50
+ label="Length Penalty",
51
+ )
52
+ gr.Markdown("Penalizes shorter outputs.")
53
+
54
+ process_button.click(
55
+ fn=paraphrase_text,
56
+ inputs=[
57
+ input_text,
58
+ model_dropdown,
59
+ temperature_slider,
60
+ repetition_penalty_slider,
61
+ top_k_slider,
62
+ length_penalty_slider,
63
+ ],
64
+ outputs=output_label,
65
+ )