Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -62,11 +62,11 @@ def predict(query):
|
|
62 |
def findRealProb(data):
|
63 |
with app.app_context():
|
64 |
if data is None or len(data) == 0:
|
65 |
-
return
|
66 |
if len(data) > 9400:
|
67 |
-
return
|
68 |
if len(data.split()) > 1500:
|
69 |
-
return
|
70 |
|
71 |
# return {"Real": predict(data)}
|
72 |
chunksOfText = (chunks_of_900(data))
|
@@ -91,7 +91,7 @@ def findRealProb(data):
|
|
91 |
label = "Human"
|
92 |
elif realProb > 0.3 and realProb < 0.7:
|
93 |
label = "Might be AI"
|
94 |
-
return
|
95 |
|
96 |
demo = gr.Interface(
|
97 |
fn=findRealProb,
|
|
|
62 |
def findRealProb(data):
|
63 |
with app.app_context():
|
64 |
if data is None or len(data) == 0:
|
65 |
+
return ({'error': 'No query provided'})
|
66 |
if len(data) > 9400:
|
67 |
+
return ({'error': 'Cannot analyze more than 9400 characters!'})
|
68 |
if len(data.split()) > 1500:
|
69 |
+
return ({'error': 'Cannot analyze more than 1500 words'})
|
70 |
|
71 |
# return {"Real": predict(data)}
|
72 |
chunksOfText = (chunks_of_900(data))
|
|
|
91 |
label = "Human"
|
92 |
elif realProb > 0.3 and realProb < 0.7:
|
93 |
label = "Might be AI"
|
94 |
+
return ({"Real": realProb, "Fake": 1-realProb, "Label": label, "Chunks": results})
|
95 |
|
96 |
demo = gr.Interface(
|
97 |
fn=findRealProb,
|