Spaces:
Runtime error
Runtime error
add upload function
Browse files- app.py +10 -3
- requirements.txt +2 -1
app.py
CHANGED
@@ -3,6 +3,7 @@ from transformers import AutoModelForSequenceClassification
|
|
3 |
from transformers import AutoTokenizer
|
4 |
import gradio as gr
|
5 |
import torch
|
|
|
6 |
|
7 |
# Load trained model
|
8 |
model = AutoModelForSequenceClassification.from_pretrained("chkla/parlbert-topic-german")
|
@@ -43,11 +44,17 @@ with gr.Blocks() as demo:
|
|
43 |
)
|
44 |
|
45 |
# Upload file
|
46 |
-
|
47 |
-
|
|
|
|
|
48 |
|
49 |
# Link to paper and Github repo
|
50 |
gr.Markdown('''For more details: You can read our [paper](http://www.lrec-conf.org/proceedings/lrec2022/workshops/ParlaCLARINIII/pdf/2022.parlaclariniii-1.13.pdf) or access our [code](https://github.com/chkla/FrameASt).''')
|
51 |
gr.Markdown('''Enjoy and stay tuned π''')
|
52 |
|
53 |
-
|
|
|
|
|
|
|
|
|
|
3 |
from transformers import AutoTokenizer
|
4 |
import gradio as gr
|
5 |
import torch
|
6 |
+
import pandas as pd
|
7 |
|
8 |
# Load trained model
|
9 |
model = AutoModelForSequenceClassification.from_pretrained("chkla/parlbert-topic-german")
|
|
|
44 |
)
|
45 |
|
46 |
# Upload file
|
47 |
+
file_output = gr.File()
|
48 |
+
upload_button = gr.UploadButton("Click to Upload a File", type="file", accept=".csv", label="File", outputs=[file_output])
|
49 |
+
gr.Dataframe(pd.DataFrame(file_output))
|
50 |
+
|
51 |
|
52 |
# Link to paper and Github repo
|
53 |
gr.Markdown('''For more details: You can read our [paper](http://www.lrec-conf.org/proceedings/lrec2022/workshops/ParlaCLARINIII/pdf/2022.parlaclariniii-1.13.pdf) or access our [code](https://github.com/chkla/FrameASt).''')
|
54 |
gr.Markdown('''Enjoy and stay tuned π''')
|
55 |
|
56 |
+
def main():
|
57 |
+
demo.launch()
|
58 |
+
|
59 |
+
if __name__ == "__main__":
|
60 |
+
main()
|
requirements.txt
CHANGED
@@ -3,4 +3,5 @@ hatesonar==0.0.7
|
|
3 |
torch==1.8.0
|
4 |
transformers==4.10.0
|
5 |
scikit_learn==0.23.1
|
6 |
-
textblob==0.15.0
|
|
|
|
3 |
torch==1.8.0
|
4 |
transformers==4.10.0
|
5 |
scikit_learn==0.23.1
|
6 |
+
textblob==0.15.0
|
7 |
+
pandas
|