Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ def humanize(
|
|
32 |
)
|
33 |
return result
|
34 |
|
35 |
-
def
|
36 |
url = "http://34.66.10.188/ai-vs-human"
|
37 |
access_key = "6mcemwsFycVVgVjMFwKXki3zJka1r7N4u$Z0Y|x$gecC$hdNtpQf-SpL0+=k;u%BZ"
|
38 |
headers = {
|
@@ -56,11 +56,11 @@ def ai_generated_test_sapling(text):
|
|
56 |
|
57 |
def ai_check(text, option):
|
58 |
if option == 'Polygraf AI':
|
59 |
-
return
|
60 |
elif option == 'Sapling AI':
|
61 |
return ai_generated_test_sapling(text)
|
62 |
-
else
|
63 |
-
return
|
64 |
|
65 |
def update_visibility_api(model):
|
66 |
if model in ['OpenAI GPT 3.5', 'OpenAI GPT 4']:
|
@@ -98,7 +98,7 @@ with gr.Blocks() as demo:
|
|
98 |
choices=[
|
99 |
"Polygraf AI",
|
100 |
"Sapling AI",
|
101 |
-
],label="Select AI Detector", visible=False)
|
102 |
only_ai_check_btn = gr.Button("AI Check", visible= False)
|
103 |
bcLabel = gr.Label(label="Source", visible= False)
|
104 |
humanizer_btn = gr.Button("Humanize", visible=False)
|
@@ -164,7 +164,7 @@ with gr.Blocks() as demo:
|
|
164 |
ai_article_btn.click(on_first_button_click, inputs=None, outputs=ai_generated)
|
165 |
ai_article_btn.click(on_first_button_click, inputs=None, outputs=ai_label)
|
166 |
ai_article_btn.click(on_first_button_click, inputs=None, outputs=only_ai_check_btn)
|
167 |
-
|
168 |
only_ai_check_btn.click(on_first_button_click, inputs=None, outputs=bcLabel)
|
169 |
only_ai_check_btn.click(on_first_button_click, inputs=None, outputs=model_dropdown)
|
170 |
only_ai_check_btn.click(on_first_button_click, inputs=None, outputs=humanizer_btn)
|
@@ -192,15 +192,15 @@ with gr.Blocks() as demo:
|
|
192 |
|
193 |
|
194 |
only_ai_check_btn.click(
|
195 |
-
fn=
|
196 |
-
inputs=[ai_label],
|
197 |
outputs=[bcLabel],
|
198 |
api_name="ai_check",
|
199 |
)
|
200 |
|
201 |
only_ai_check_btn2.click(
|
202 |
-
fn=
|
203 |
-
inputs=[
|
204 |
outputs=[bcLabel2]
|
205 |
)
|
206 |
|
|
|
32 |
)
|
33 |
return result
|
34 |
|
35 |
+
def ai_generated_test_polygraf(text):
|
36 |
url = "http://34.66.10.188/ai-vs-human"
|
37 |
access_key = "6mcemwsFycVVgVjMFwKXki3zJka1r7N4u$Z0Y|x$gecC$hdNtpQf-SpL0+=k;u%BZ"
|
38 |
headers = {
|
|
|
56 |
|
57 |
def ai_check(text, option):
|
58 |
if option == 'Polygraf AI':
|
59 |
+
return ai_generated_test_polygraf(text)
|
60 |
elif option == 'Sapling AI':
|
61 |
return ai_generated_test_sapling(text)
|
62 |
+
else:
|
63 |
+
return ai_generated_test_polygraf(text)
|
64 |
|
65 |
def update_visibility_api(model):
|
66 |
if model in ['OpenAI GPT 3.5', 'OpenAI GPT 4']:
|
|
|
98 |
choices=[
|
99 |
"Polygraf AI",
|
100 |
"Sapling AI",
|
101 |
+
],label="Select AI Detector", value="Polygraf AI", visible=False)
|
102 |
only_ai_check_btn = gr.Button("AI Check", visible= False)
|
103 |
bcLabel = gr.Label(label="Source", visible= False)
|
104 |
humanizer_btn = gr.Button("Humanize", visible=False)
|
|
|
164 |
ai_article_btn.click(on_first_button_click, inputs=None, outputs=ai_generated)
|
165 |
ai_article_btn.click(on_first_button_click, inputs=None, outputs=ai_label)
|
166 |
ai_article_btn.click(on_first_button_click, inputs=None, outputs=only_ai_check_btn)
|
167 |
+
ai_article_btn.click(on_first_button_click, inputs=None, outputs=ai_detector_dropdown)
|
168 |
only_ai_check_btn.click(on_first_button_click, inputs=None, outputs=bcLabel)
|
169 |
only_ai_check_btn.click(on_first_button_click, inputs=None, outputs=model_dropdown)
|
170 |
only_ai_check_btn.click(on_first_button_click, inputs=None, outputs=humanizer_btn)
|
|
|
192 |
|
193 |
|
194 |
only_ai_check_btn.click(
|
195 |
+
fn=ai_check,
|
196 |
+
inputs=[ai_label, ai_detector_dropdown],
|
197 |
outputs=[bcLabel],
|
198 |
api_name="ai_check",
|
199 |
)
|
200 |
|
201 |
only_ai_check_btn2.click(
|
202 |
+
fn=ai_check,
|
203 |
+
inputs=[ai_label, ai_detector_dropdown],
|
204 |
outputs=[bcLabel2]
|
205 |
)
|
206 |
|