Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
|
3 |
|
4 |
# Models included within the interface
|
@@ -25,14 +26,26 @@ model_mapping = {
|
|
25 |
("roberta-base", "dmitva/human_ai_generated_text - Both AI and Human Data"): "SkwarczynskiP/roberta-base-finetuned-dmitva-AI-and-human-generated"
|
26 |
}
|
27 |
|
28 |
-
#
|
29 |
-
|
30 |
["ex1"],
|
31 |
["ex2"],
|
32 |
["ex3"],
|
33 |
["ex4"]
|
34 |
]
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
def detect_ai_generated_text(model: str, dataset: str, text: str) -> str:
|
38 |
# Get the fine-tuned model using mapping
|
|
|
1 |
import gradio as gr
|
2 |
+
import random
|
3 |
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
|
4 |
|
5 |
# Models included within the interface
|
|
|
26 |
("roberta-base", "dmitva/human_ai_generated_text - Both AI and Human Data"): "SkwarczynskiP/roberta-base-finetuned-dmitva-AI-and-human-generated"
|
27 |
}
|
28 |
|
29 |
+
# Example text included within the interface
|
30 |
+
exampleText = [
|
31 |
["ex1"],
|
32 |
["ex2"],
|
33 |
["ex3"],
|
34 |
["ex4"]
|
35 |
]
|
36 |
|
37 |
+
# Example models and datasets included within the interface
|
38 |
+
exampleModels = ["bert-base-uncased", "roberta-base"]
|
39 |
+
|
40 |
+
# Example datasets included within the interface
|
41 |
+
exampleDatasets = ["No Dataset Finetuning",
|
42 |
+
"vedantgaur/GPTOutputs-MWP - AI Data Only",
|
43 |
+
"vedantgaur/GPTOutputs-MWP - Human Data Only",
|
44 |
+
"vedantgaur/GPTOutputs-MWP - Both AI and Human Data",
|
45 |
+
"dmitva/human_ai_generated_text - Both AI and Human Data"]
|
46 |
+
|
47 |
+
examples = [[random.choice(exampleModels), random.choice(exampleDatasets), random.choice(exampleText)] for example in exampleText]
|
48 |
+
|
49 |
|
50 |
def detect_ai_generated_text(model: str, dataset: str, text: str) -> str:
|
51 |
# Get the fine-tuned model using mapping
|