Avmromanov commited on
Commit
7083a37
·
1 Parent(s): 528a96f

first implementation

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -1,7 +1,17 @@
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
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ model_name = "ProsusAI/finbert"
5
+ task = 'sentiment-analysis'
6
 
7
+ def predict_sentiment(text: str, task: str, model: str):
8
+ """
9
+ Инициализируйте пайплайн и предскажите им текст
10
+ """
11
+ pipe = pipeline(task=task, model=model)
12
+
13
+ pipeline_result = pipe(text)
14
+ return pipeline_result
15
+
16
+ demo = gr.Interface(fn=predict_sentiment, inputs="text", outputs="text")
17
  demo.launch()