Update app.py
Browse files
app.py
CHANGED
@@ -99,7 +99,7 @@ class TextClassifier:
|
|
99 |
num_labels=2
|
100 |
).to(self.device)
|
101 |
|
102 |
-
model_path = "
|
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 |
-
|
357 |
)
|
358 |
|
359 |
-
# Launch
|
360 |
if __name__ == "__main__":
|
361 |
-
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|