Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
from flask import Flask, request
|
2 |
from transformers import RobertaForSequenceClassification, RobertaTokenizer, RobertaConfig
|
|
|
|
|
|
|
3 |
import torch
|
4 |
import gradio as gr
|
5 |
import os
|
@@ -9,11 +12,14 @@ import pdfplumber
|
|
9 |
app = Flask(__name__)
|
10 |
|
11 |
ACCESS_TOKEN = os.environ["ACCESS_TOKEN"]
|
12 |
-
config = RobertaConfig.from_pretrained("PirateXX/ChatGPT-Text-Detector", use_auth_token= ACCESS_TOKEN)
|
13 |
-
model = RobertaForSequenceClassification.from_pretrained("PirateXX/ChatGPT-Text-Detector", use_auth_token= ACCESS_TOKEN, config = config)
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
model_name = "roberta-base"
|
16 |
-
tokenizer = RobertaTokenizer.from_pretrained(model_name, map_location=torch.device('cpu'))
|
17 |
|
18 |
# function to break text into an array of sentences
|
19 |
def text_to_sentences(text):
|
|
|
1 |
from flask import Flask, request
|
2 |
from transformers import RobertaForSequenceClassification, RobertaTokenizer, RobertaConfig
|
3 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
4 |
+
from transformers import RobertaConfig
|
5 |
+
from torch import cuda
|
6 |
import torch
|
7 |
import gradio as gr
|
8 |
import os
|
|
|
12 |
app = Flask(__name__)
|
13 |
|
14 |
ACCESS_TOKEN = os.environ["ACCESS_TOKEN"]
|
15 |
+
# config = RobertaConfig.from_pretrained("PirateXX/ChatGPT-Text-Detector", use_auth_token= ACCESS_TOKEN)
|
16 |
+
# model = RobertaForSequenceClassification.from_pretrained("PirateXX/ChatGPT-Text-Detector", use_auth_token= ACCESS_TOKEN, config = config)
|
17 |
+
|
18 |
+
# model_name = "roberta-base"
|
19 |
+
# tokenizer = RobertaTokenizer.from_pretrained(model_name, map_location=torch.device('cpu'))
|
20 |
+
tokenizer = AutoTokenizer.from_pretrained("PirateXX/AI-Content-Detector", use_auth_token= ACCESS_TOKEN)
|
21 |
+
model = AutoModelForSequenceClassification.from_pretrained("PirateXX/AI-Content-Detector", use_auth_token= ACCESS_TOKEN)
|
22 |
|
|
|
|
|
23 |
|
24 |
# function to break text into an array of sentences
|
25 |
def text_to_sentences(text):
|