ApsidalSolid4 commited on
Commit
98f1c59
·
verified ·
1 Parent(s): 0758af0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -13
app.py CHANGED
@@ -99,7 +99,7 @@ class TextClassifier:
99
  num_labels=2
100
  ).to(self.device)
101
 
102
- model_path = "model_20250209_184929_acc1.0000.pt"
103
  if os.path.exists(model_path):
104
  logger.info(f"Loading custom model from {model_path}")
105
  checkpoint = torch.load(model_path, map_location=self.device)
@@ -353,18 +353,9 @@ demo = gr.Interface(
353
  ["This is a sample text written by a human. It contains multiple sentences with different ideas. The analysis will show how each sentence is classified.", "quick"],
354
  ["This is a sample text written by a human. It contains multiple sentences with different ideas. The analysis will show how each sentence is classified.", "detailed"],
355
  ],
356
- flagging_mode=None
357
  )
358
 
359
- # Launch with minimal configuration
360
  if __name__ == "__main__":
361
- if os.getenv('SPACE_ID'):
362
- # Running on Hugging Face Spaces
363
- demo.launch()
364
- else:
365
- # Running locally
366
- demo.launch(
367
- server_name="0.0.0.0",
368
- server_port=7860,
369
- share=False
370
- )
 
99
  num_labels=2
100
  ).to(self.device)
101
 
102
+ model_path = "model.pt"
103
  if os.path.exists(model_path):
104
  logger.info(f"Loading custom model from {model_path}")
105
  checkpoint = torch.load(model_path, map_location=self.device)
 
353
  ["This is a sample text written by a human. It contains multiple sentences with different ideas. The analysis will show how each sentence is classified.", "quick"],
354
  ["This is a sample text written by a human. It contains multiple sentences with different ideas. The analysis will show how each sentence is classified.", "detailed"],
355
  ],
356
+ allow_flagging="never"
357
  )
358
 
359
+ # Launch the interface
360
  if __name__ == "__main__":
361
+ demo.launch(share=True)