Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,10 +3,9 @@ import pandas as pd
|
|
3 |
import numpy as np
|
4 |
import spacy
|
5 |
from spacy import displacy
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
def linkify():
|
10 |
import pandas as pd
|
11 |
import streamlit as st
|
12 |
link1 = "https://stackoverflow.com/questions/71641666/hyperlink-in-streamlit-dataframe"
|
@@ -49,7 +48,6 @@ def bulk_function(filename):
|
|
49 |
print(filename, type(filename))
|
50 |
print(filename.name)
|
51 |
|
52 |
-
|
53 |
# check type of input file
|
54 |
if filename.name.split(".")[1] == "csv":
|
55 |
print("entered")
|
@@ -65,12 +63,6 @@ def bulk_function(filename):
|
|
65 |
else:
|
66 |
return
|
67 |
|
68 |
-
|
69 |
-
# read csv
|
70 |
-
# even if index given, drop it
|
71 |
-
#df_input = pd.read_csv(filename.name, index_col=False)
|
72 |
-
#print("df_input", df_input)
|
73 |
-
|
74 |
# expect csv format to be in:
|
75 |
# 1: ID
|
76 |
# 2: Texts
|
@@ -130,13 +122,16 @@ def bulk_function(filename):
|
|
130 |
# return dataframe for space output
|
131 |
return YOUR_FILENAME
|
132 |
|
133 |
-
gr.Interface(
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
135 |
outputs=[gr.outputs.File(label="Output file")],
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
allow_flagging=False,
|
142 |
-
).launch(debug=True)
|
|
|
3 |
import numpy as np
|
4 |
import spacy
|
5 |
from spacy import displacy
|
6 |
+
from transformers import AutoTokenizer,AutoModelForSequenceClassification, Trainer
|
7 |
|
8 |
+
def linkifyHTML():
|
|
|
|
|
9 |
import pandas as pd
|
10 |
import streamlit as st
|
11 |
link1 = "https://stackoverflow.com/questions/71641666/hyperlink-in-streamlit-dataframe"
|
|
|
48 |
print(filename, type(filename))
|
49 |
print(filename.name)
|
50 |
|
|
|
51 |
# check type of input file
|
52 |
if filename.name.split(".")[1] == "csv":
|
53 |
print("entered")
|
|
|
63 |
else:
|
64 |
return
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
# expect csv format to be in:
|
67 |
# 1: ID
|
68 |
# 2: Texts
|
|
|
122 |
# return dataframe for space output
|
123 |
return YOUR_FILENAME
|
124 |
|
125 |
+
gr.Interface(
|
126 |
+
bulk_function,
|
127 |
+
inputs=[gr.inputs.File(file_count="single",
|
128 |
+
type="file",
|
129 |
+
label="Upload file",
|
130 |
+
optional=False),
|
131 |
+
],
|
132 |
outputs=[gr.outputs.File(label="Output file")],
|
133 |
+
theme="huggingface",
|
134 |
+
title="CSV File to Sentence Emotion Classification",
|
135 |
+
description="Upload csv file with 2 columns (in order): (a) ID column, (b) text column. Model: https://huggingface.co/j-hartmann/emotion-english-distilroberta-base.",
|
136 |
+
allow_flagging=False,
|
137 |
+
).launch(debug=True)
|
|
|
|