Zoltan100 commited on
Commit
7217a85
·
1 Parent(s): 537f649

my latest updates…

Browse files
Files changed (2) hide show
  1. app.py +24 -3
  2. requirements.txt +2 -0
app.py CHANGED
@@ -1,7 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
 
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
7
  demo.launch()
 
1
+ # https://huggingface.co/spaces/Zoltan100/test
2
+
3
+ # import gradio as gr
4
+ #
5
+ # def greet(name):
6
+ # return "Hello " + name + "!!"
7
+ #
8
+ # demo = gr.Interface(fn=greet, inputs="text", outputs="text")
9
+ # demo.launch()
10
+
11
+
12
  import gradio as gr
13
+ from transformers import pipeline
14
+
15
+ model = pipeline("sentiment-analysis")
16
 
17
+ # Define inference function
18
+ def predict(text):
19
+ outputs = model(text)
20
+ return outputs
21
 
22
+ # Create Gradio interface
23
+ demo = gr.Interface(
24
+ fn=predict,
25
+ inputs="text", outputs="text",
26
+ title="Sentiment Analysis"
27
+ )
28
  demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ transformers