SamanthaStorm commited on
Commit
d040562
·
verified ·
1 Parent(s): 3d1dd0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -1,4 +1,4 @@
1
- import gradio as gr
2
  import torch
3
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
4
  import numpy as np
@@ -45,20 +45,20 @@ class FallacyFinder:
45
  'no_fallacy': "The statement appears to be logically sound and free of common fallacies."
46
  }
47
 
48
- # Try to load model, fallback to rule-based if not available
49
  self.model = None
50
  self.tokenizer = None
51
  self.use_model = False
52
 
53
  try:
54
- # This would be your trained model path
55
- # For now, we'll use a rule-based approach
56
- # self.tokenizer = AutoTokenizer.from_pretrained("your-model-path")
57
- # self.model = AutoModelForSequenceClassification.from_pretrained("your-model-path")
58
- # self.use_model = True
59
- pass
60
- except:
61
- print("Model not found, using rule-based approach")
62
 
63
  def predict_with_rules(self, text):
64
  """Rule-based fallacy detection for when model isn't available"""
 
1
+ iimport gradio as gr
2
  import torch
3
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
4
  import numpy as np
 
45
  'no_fallacy': "The statement appears to be logically sound and free of common fallacies."
46
  }
47
 
48
+ # Load your trained model from Hugging Face
49
  self.model = None
50
  self.tokenizer = None
51
  self.use_model = False
52
 
53
  try:
54
+ print("Loading model: SamanthaStorm/fallacyfinder")
55
+ self.tokenizer = AutoTokenizer.from_pretrained("SamanthaStorm/fallacyfinder")
56
+ self.model = AutoModelForSequenceClassification.from_pretrained("SamanthaStorm/fallacyfinder")
57
+ self.use_model = True
58
+ print("✅ Model loaded successfully!")
59
+ except Exception as e:
60
+ print(f"❌ Error loading model: {e}")
61
+ print("Falling back to rule-based approach")
62
 
63
  def predict_with_rules(self, text):
64
  """Rule-based fallacy detection for when model isn't available"""