minko186 commited on
Commit
46f0706
·
verified ·
1 Parent(s): cfcd65e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -22
app.py CHANGED
@@ -4,27 +4,35 @@ from gradio_client import Client
4
  from ai_generate import generate
5
 
6
  # client = Client("polygraf-ai/Humanizer")
7
- # def humanize(
8
- # text,
9
- # model,
10
- # temperature=1.2,
11
- # repetition_penalty=1,
12
- # top_k=50,
13
- # length_penalty=1,
14
- # ):
15
- # ai_text = generate(f"Write an article about the topic: {text}")
16
- # ai_text = ai_text.choices[0].message.content
17
- # print(f"AI Generated: {ai_text}")
18
- # result = client.predict(
19
- # text=ai_text,
20
- # model_name=model,
21
- # temperature=temperature,
22
- # repetition_penalty=repetition_penalty,
23
- # top_k=top_k,
24
- # length_penalty=length_penalty,
25
- # api_name="/paraphrase_text"
26
- # )
27
- # return ai_text, result
 
 
 
 
 
 
 
 
28
 
29
  with gr.Blocks() as demo:
30
  gr.Markdown("# Polygraf Writer")
@@ -79,7 +87,7 @@ with gr.Blocks() as demo:
79
  gr.Markdown("Penalizes shorter outputs.")
80
 
81
  process_button.click(
82
- fn=paraphrase_text,
83
  inputs=[
84
  input_topic,
85
  model_dropdown,
 
4
  from ai_generate import generate
5
 
6
  # client = Client("polygraf-ai/Humanizer")
7
+ def humanize(
8
+ text,
9
+ model,
10
+ temperature=1.2,
11
+ repetition_penalty=1,
12
+ top_k=50,
13
+ length_penalty=1,
14
+ ):
15
+ ai_text = generate(f"Write an article about the topic: {text}")
16
+ ai_text = ai_text.choices[0].message.content
17
+ print(f"AI Generated: {ai_text}")
18
+ # result = client.predict(
19
+ # text=ai_text,
20
+ # model_name=model,
21
+ # temperature=temperature,
22
+ # repetition_penalty=repetition_penalty,
23
+ # top_k=top_k,
24
+ # length_penalty=length_penalty,
25
+ # api_name="/paraphrase_text"
26
+ # )
27
+ result = paraphrase_text(
28
+ text=ai_text,
29
+ model_name=model,
30
+ temperature=temperature,
31
+ repetition_penalty=repetition_penalty,
32
+ top_k=top_k,
33
+ length_penalty=length_penalty,
34
+ )
35
+ return ai_text, result
36
 
37
  with gr.Blocks() as demo:
38
  gr.Markdown("# Polygraf Writer")
 
87
  gr.Markdown("Penalizes shorter outputs.")
88
 
89
  process_button.click(
90
+ fn=humanize,
91
  inputs=[
92
  input_topic,
93
  model_dropdown,