AmpomahChief commited on
Commit
449ab17
1 Parent(s): 7a5a651

Update gradioapp.py

Browse files
Files changed (1) hide show
  1. gradioapp.py +30 -6
gradioapp.py CHANGED
@@ -21,11 +21,35 @@
21
  # # Launch the interface
22
  # interface.launch()
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  import gradio as gr
25
- # Creating a gradio app using the inferene API
26
- App = gr.Interface.load("huggingface/AmpomahChief/sentiment_analysis_on_covid_tweets",
27
- title="COVID 19 tweets sentiment analysis", description ="This is a sentiment analysis on COVID 19 tweets using pretrained model on hugging face",
28
- allow_flagging=False, examples=[["Input your text here"]]
29
- )
 
 
 
 
 
 
 
 
30
 
31
- App.launch()
 
 
21
  # # Launch the interface
22
  # 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()