minko186 commited on
Commit
cfcd65e
·
verified ·
1 Parent(s): 42f072b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -24
app.py CHANGED
@@ -1,30 +1,30 @@
1
  import gradio as gr
2
- # from humanize import paraphrase_text
3
  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 +79,7 @@ with gr.Blocks() as demo:
79
  gr.Markdown("Penalizes shorter outputs.")
80
 
81
  process_button.click(
82
- fn=humanize,
83
  inputs=[
84
  input_topic,
85
  model_dropdown,
 
1
  import gradio as gr
2
+ from humanize import paraphrase_text
3
  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
  gr.Markdown("Penalizes shorter outputs.")
80
 
81
  process_button.click(
82
+ fn=paraphrase_text,
83
  inputs=[
84
  input_topic,
85
  model_dropdown,