Spaces:
Runtime error
Runtime error
asd
Browse files
app.py
CHANGED
@@ -53,7 +53,7 @@
|
|
53 |
import gradio as gr
|
54 |
from openai import OpenAI
|
55 |
import torch
|
56 |
-
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
57 |
|
58 |
# define the openai key
|
59 |
api_key = "sk-proj-UCoZZMs4MyfyHwXdHjT8T3BlbkFJjYkSZyPfIPNqXfXwoekm"
|
@@ -65,8 +65,14 @@ client = OpenAI(api_key = api_key)
|
|
65 |
finetuned_model = "ft:gpt-3.5-turbo-0125:personal::9qGC8cwZ"
|
66 |
|
67 |
# Load model directly
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
# Define the function to get predictions
|
72 |
def get_prediction(text):
|
|
|
53 |
import gradio as gr
|
54 |
from openai import OpenAI
|
55 |
import torch
|
56 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification, TFAutoModelForSequenceClassification
|
57 |
|
58 |
# define the openai key
|
59 |
api_key = "sk-proj-UCoZZMs4MyfyHwXdHjT8T3BlbkFJjYkSZyPfIPNqXfXwoekm"
|
|
|
65 |
finetuned_model = "ft:gpt-3.5-turbo-0125:personal::9qGC8cwZ"
|
66 |
|
67 |
# Load model directly
|
68 |
+
model_name = "tommyliphys/ai-detector-distilbert"
|
69 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
70 |
+
|
71 |
+
# Load TensorFlow model
|
72 |
+
tf_model = TFAutoModelForSequenceClassification.from_pretrained(model_name, from_tf=True)
|
73 |
+
|
74 |
+
# Convert to PyTorch model
|
75 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name, from_tf=True)
|
76 |
|
77 |
# Define the function to get predictions
|
78 |
def get_prediction(text):
|