AmpomahChief commited on
Commit
7ff054e
1 Parent(s): a0050ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -23,33 +23,33 @@
23
 
24
 
25
 
26
- # import gradio as gr
27
- # # Creating a gradio app using the inferene API
28
- # App = gr.Interface.load("huggingface/AmpomahChief/sentiment_analysis_on_covid_tweets",
29
- # title="COVID 19 tweets sentiment analysis", description ="This is a sentiment analysis on COVID 19 tweets using pretrained model on hugging face",
30
- # allow_flagging=False, examples=[["Input your text here"]]
31
- # )
32
 
33
- # App.launch()
34
 
35
 
36
 
37
 
38
 
39
- import gradio as gr
40
- from transformers import pipeline
41
- import transformers
42
 
43
- Model = transformers.AutoModel.from_pretrained('AmpomahChief/sentiment_analysis_on_covid_tweets')
44
- pipeline = pipeline(task="image-classification", model=Model)
45
 
46
- def predict(inputs):
47
- input_ids = transformers.BertTokenizer.from_pretrained('AmpomahChief/sentiment_analysis_on_covid_tweets').encode(inputs, return_tensors='pt')
48
- output = model(input_ids)[0]
49
- return output
50
 
51
- # Create a Gradio interface for the model
52
- interface = gr.Interface(fn=predict, inputs=gr.Textbox(prompt="Input text:"), outputs=gr.Textbox(prompt="Model output:"))
53
 
54
- # Launch the interface
55
- interface.launch()
 
23
 
24
 
25
 
26
+ import gradio as gr
27
+ # Creating a gradio app using the inferene API
28
+ App = gr.Interface.load("huggingface/AmpomahChief/sentiment_analysis_on_covid_tweets",
29
+ title="COVID 19 tweets sentiment analysis", description ="This is a sentiment analysis on COVID 19 tweets using pretrained model on hugging face",
30
+ allow_flagging=False, examples=[["Input your text here"]]
31
+ )
32
 
33
+ App.launch()
34
 
35
 
36
 
37
 
38
 
39
+ # import gradio as gr
40
+ # from transformers import pipeline
41
+ # import transformers
42
 
43
+ # Model = transformers.AutoModel.from_pretrained('AmpomahChief/sentiment_analysis_on_covid_tweets')
44
+ # pipeline = pipeline(task="image-classification", model=Model)
45
 
46
+ # def predict(inputs):
47
+ # input_ids = transformers.BertTokenizer.from_pretrained('AmpomahChief/sentiment_analysis_on_covid_tweets').encode(inputs, return_tensors='pt')
48
+ # output = model(input_ids)[0]
49
+ # return output
50
 
51
+ # # Create a Gradio interface for the model
52
+ # interface = gr.Interface(fn=predict, inputs=gr.Textbox(prompt="Input text:"), outputs=gr.Textbox(prompt="Model output:"))
53
 
54
+ # # Launch the interface
55
+ # interface.launch()