Spaces:
Sleeping
Sleeping
samiNCL
commited on
Commit
•
6abdba3
1
Parent(s):
ba6e3c0
Final final FINAL
Browse files
app.py
CHANGED
@@ -1,36 +1,4 @@
|
|
1 |
-
|
2 |
-
# from transformers import pipeline
|
3 |
-
# import gradio as gr
|
4 |
-
# import io
|
5 |
-
|
6 |
-
# # Initialize sentiment analysis pipeline
|
7 |
-
# sentiment_pipeline = pipeline('sentiment-analysis')
|
8 |
-
|
9 |
-
# def process_csv(file):
|
10 |
-
# df = pd.read_csv(io.StringIO(file))
|
11 |
-
# sentiments = []
|
12 |
-
# for _, row in df.iterrows():
|
13 |
-
# text = row['Content']
|
14 |
-
# sentiment = analyze_sentiment(text)
|
15 |
-
# sentiments.append(sentiment)
|
16 |
-
|
17 |
-
# df['sentiment'] = sentiments
|
18 |
-
|
19 |
-
# return df.to_csv(index=False)
|
20 |
-
|
21 |
-
# def analyze_sentiment(text):
|
22 |
-
# result = sentiment_pipeline(text)[0]
|
23 |
-
# sentiment = result['label']
|
24 |
-
# return sentiment
|
25 |
-
|
26 |
-
# def analyze_text(text):
|
27 |
-
# sentiment = analyze_sentiment(text)
|
28 |
-
# return sentiment
|
29 |
-
|
30 |
-
# iface = gr.Interface(fn=analyze_text, inputs=gr.inputs.Textbox(lines=13, label="Enter Text"), outputs="text")
|
31 |
-
# iface.launch(share=True)
|
32 |
-
|
33 |
-
|
34 |
|
35 |
import pandas as pd
|
36 |
from transformers import pipeline
|
@@ -44,4 +12,4 @@ def analyze_text(text):
|
|
44 |
return sentiment['label']
|
45 |
|
46 |
iface = gr.Interface(fn=analyze_text, inputs=gr.inputs.Textbox(lines=13, label="Enter Text"), outputs="text")
|
47 |
-
iface.launch(
|
|
|
1 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
import pandas as pd
|
4 |
from transformers import pipeline
|
|
|
12 |
return sentiment['label']
|
13 |
|
14 |
iface = gr.Interface(fn=analyze_text, inputs=gr.inputs.Textbox(lines=13, label="Enter Text"), outputs="text")
|
15 |
+
iface.launch()
|