Kuberwastaken commited on
Commit
27410c8
·
verified ·
1 Parent(s): d056a59

Updated model to flan t5 large for better accuracy

Browse files
Files changed (1) hide show
  1. gradio_app.py +4 -4
gradio_app.py CHANGED
@@ -105,7 +105,7 @@ class FlanT5Analyzer:
105
  progress(0.1, "🍩 Loading tokenizer...")
106
 
107
  self.tokenizer = AutoTokenizer.from_pretrained(
108
- "google/flan-t5-base",
109
  use_fast=True
110
  )
111
 
@@ -113,7 +113,7 @@ class FlanT5Analyzer:
113
  progress(0.3, "🍰 Loading model...")
114
 
115
  self.model = AutoModelForSeq2SeqLM.from_pretrained(
116
- "google/flan-t5-base",
117
  torch_dtype=torch.float16 if self.device == "cuda" else torch.float32,
118
  device_map="auto"
119
  )
@@ -504,7 +504,7 @@ async def analyze_content_flant5(
504
  result = {
505
  "detected_triggers": triggers,
506
  "confidence": "High - Content detected" if triggers != ["None"] else "High - No concerning content detected",
507
- "model": "google/flan-t5-base",
508
  "analysis_timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
509
  }
510
 
@@ -516,7 +516,7 @@ async def analyze_content_flant5(
516
  return {
517
  "detected_triggers": ["Error occurred during analysis"],
518
  "confidence": "Error",
519
- "model": "google/flan-t5-base",
520
  "analysis_timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
521
  "error": str(e)
522
  }
 
105
  progress(0.1, "🍩 Loading tokenizer...")
106
 
107
  self.tokenizer = AutoTokenizer.from_pretrained(
108
+ "google/flan-t5-large",
109
  use_fast=True
110
  )
111
 
 
113
  progress(0.3, "🍰 Loading model...")
114
 
115
  self.model = AutoModelForSeq2SeqLM.from_pretrained(
116
+ "google/flan-t5-large",
117
  torch_dtype=torch.float16 if self.device == "cuda" else torch.float32,
118
  device_map="auto"
119
  )
 
504
  result = {
505
  "detected_triggers": triggers,
506
  "confidence": "High - Content detected" if triggers != ["None"] else "High - No concerning content detected",
507
+ "model": "google/flan-t5-large",
508
  "analysis_timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
509
  }
510
 
 
516
  return {
517
  "detected_triggers": ["Error occurred during analysis"],
518
  "confidence": "Error",
519
+ "model": "google/flan-t5-large",
520
  "analysis_timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
521
  "error": str(e)
522
  }