Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
import numpy as np
|
| 3 |
from transformers import Trainer, AutoTokenizer, XLMRobertaForSequenceClassification
|
| 4 |
import torch
|
|
|
|
| 5 |
import re
|
| 6 |
|
| 7 |
def checker(content):
|
|
@@ -24,11 +25,12 @@ def checker(content):
|
|
| 24 |
# Funktion zur Verarbeitung der hochgeladenen Datei
|
| 25 |
def process_file(file):
|
| 26 |
if file:
|
| 27 |
-
with open(file.name, 'r', encoding='utf-8') as f:
|
| 28 |
-
|
| 29 |
-
|
|
|
|
| 30 |
return content
|
| 31 |
-
return "
|
| 32 |
|
| 33 |
# Gradio Interface
|
| 34 |
with gr.Blocks(css=".gr-box {border-radius: 8px;}") as demo:
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
from transformers import Trainer, AutoTokenizer, XLMRobertaForSequenceClassification
|
| 4 |
import torch
|
| 5 |
+
import pickle
|
| 6 |
import re
|
| 7 |
|
| 8 |
def checker(content):
|
|
|
|
| 25 |
# Funktion zur Verarbeitung der hochgeladenen Datei
|
| 26 |
def process_file(file):
|
| 27 |
if file:
|
| 28 |
+
#with open(file.name, 'r', encoding='utf-8') as f:
|
| 29 |
+
# content = f.read()
|
| 30 |
+
with open(file.name, 'rb') as f:
|
| 31 |
+
content = pickle.load(f)
|
| 32 |
return content
|
| 33 |
+
return "Datei konnte nicht gelesen werden"
|
| 34 |
|
| 35 |
# Gradio Interface
|
| 36 |
with gr.Blocks(css=".gr-box {border-radius: 8px;}") as demo:
|