NoaiGPT commited on
Commit
02a8691
·
1 Parent(s): c2a367d
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -54,7 +54,7 @@ import gradio as gr
54
  from openai import OpenAI
55
  import os
56
  import re
57
- from transformers import pipeline
58
 
59
  # define the openai key
60
  api_key = "sk-proj-UCoZZMs4MyfyHwXdHjT8T3BlbkFJjYkSZyPfIPNqXfXwoekm"
@@ -66,7 +66,11 @@ client = OpenAI(api_key = api_key)
66
  finetuned_model = "ft:gpt-3.5-turbo-0125:personal::9qGC8cwZ"
67
 
68
  # Load the AI detection model
69
- pipe = pipeline("text-classification", model="tommyliphys/ai-detector-distilbert")
 
 
 
 
70
 
71
  # Define the function to get predictions
72
  def get_prediction(text):
 
54
  from openai import OpenAI
55
  import os
56
  import re
57
+ from transformers import pipeline, TFDistilBertForSequenceClassification, DistilBertTokenizerFast
58
 
59
  # define the openai key
60
  api_key = "sk-proj-UCoZZMs4MyfyHwXdHjT8T3BlbkFJjYkSZyPfIPNqXfXwoekm"
 
66
  finetuned_model = "ft:gpt-3.5-turbo-0125:personal::9qGC8cwZ"
67
 
68
  # Load the AI detection model
69
+ model_name = "tommyliphys/ai-detector-distilbert"
70
+ model = TFDistilBertForSequenceClassification.from_pretrained(model_name, from_tf=True)
71
+ tokenizer = DistilBertTokenizerFast.from_pretrained(model_name)
72
+
73
+ pipe = pipeline("text-classification", model=model, tokenizer=tokenizer)
74
 
75
  # Define the function to get predictions
76
  def get_prediction(text):