File size: 1,669 Bytes
da88846
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
52
53
54
55
56
57
58
59
60
61
from gradio_client import Client, file, handle_file

client = Client("http://sd.demo.polygraf.ai:7890/")

generated_text = client.predict(
    input_role="Student",
    topic="Low Resource Language Models",
    keywords="",
    article_length=400,
    format="Article",
    writing_style="Formal",
    tone="Professional",
    user_category="General Public",
    depth_of_content="Moderate analysis",
    structure="Introduction, Body, Conclusion",
    references="News outlets",
    num_examples="1-2",
    conclusion_type="Call to Action",
    # ai_model="OpenAI GPT 4o Mini",
    ai_model="LLaMA 3",
    google_search_check=True,
    year_from="2000",
    month_from="January",
    day_from="01",
    year_to="2024",
    month_to="August",
    day_to="08",
    domains_to_include=["com", "org", "net", "int", "edu", "gov", "mil"],
    include_sites="",
    exclude_sites="",
    pdf_file_input=[handle_file("/home/eljan/article_writer/Abstract.pdf")],
    api_name="/generate_and_format",
)

client.predict(text="Polygraf AI (Advanced Model)", api_name="/highlight_visible_1")
detect_generated = client.predict(
    text=generated_text,
    option="Polygraf AI (Advanced Model)",
    api_name="/ai_check",
)

humanized_text = client.predict(
    text=generated_text,
    model="XL Model",
    temperature=1.2,
    repetition_penalty=1,
    top_k=50,
    length_penalty=1,
    api_name="/humanize",
)

client.predict(text="Polygraf AI (Advanced Model)", api_name="/highlight_visible_1")
detect_humanized = client.predict(
    text=humanized_text,
    option="Polygraf AI (Advanced Model)",
    api_name="/ai_check",
)

print(detect_generated)
print(detect_humanized)