themeetjani commited on
Commit
4d29f91
1 Parent(s): 9fb47f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py CHANGED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import numpy as np
3
+ import torch
4
+ import transformers
5
+ import json
6
+ import pandas as pd
7
+ from numpy.random import seed
8
+ seed(1)
9
+ import emoji
10
+ import string
11
+ import nltk
12
+ from nltk.corpus import stopwords
13
+ from nltk.stem import PorterStemmer # PorterStemmer LancasterStemmer
14
+ from nltk.stem import WordNetLemmatizer
15
+ import re
16
+ stemmer = PorterStemmer()
17
+
18
+ # uncomment this when run first time
19
+ nltk.download('wordnet')
20
+ nltk.download('omw-1.4')
21
+ nltk.download('stopwords')
22
+
23
+ lemmatizer = WordNetLemmatizer()
24
+ stopwords = nltk.corpus.stopwords.words('english')
25
+
26
+ import gradio as gr
27
+ pipe = pipeline("text-classification", model="dsmsb/16class_12k_newtest1618_xlm_roberta_base_27nov_v2_8epoch")
28
+ def classify(text):
29
+ output = pipe(return,top_k = 2)
30
+ return {"class":output}
31
+ inputs = gr.inputs.Textbox(label="pdf link")
32
+ outputs = gr.outputs.Textbox(label="OCR Text")
33
+ demo = gr.Interface(fn=classify,inputs=inputs,outputs=outputs)
34
+ demo.launch()