iffystrayer commited on
Commit
89e9e0b
·
0 Parent(s):

initial commit

Browse files
Files changed (6) hide show
  1. .python-version +1 -0
  2. README.md +0 -0
  3. app.py +0 -0
  4. main.py +36 -0
  5. pyproject.toml +7 -0
  6. requirements.txt +0 -0
.python-version ADDED
@@ -0,0 +1 @@
 
 
1
+ 3.13
README.md ADDED
File without changes
app.py ADDED
File without changes
main.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Text
2
+ import gradio as gr
3
+ from gradio.components.textbox import Textbox
4
+ from textblob import TextBlob
5
+ from ntpath import sep
6
+
7
+ def sentiment_analysis(text: str) -> dict:
8
+ """
9
+ Analyzes the sentiment of a given text.
10
+
11
+ Args:
12
+ text (str): The text to analyze.
13
+
14
+ Returns:
15
+ dict: A dictionary containing the sentiment polarity and subjectivity and assessment
16
+ """
17
+
18
+ blob = TextBlob(text)
19
+ sentiment = blob.sentiment
20
+
21
+ return {
22
+ "polarity": round(sentiment.polarity, 2),
23
+ "subjectivity": round(sentiment.subjectivity, 2),
24
+ "assessment": "positive" if sentiment.polarity > 0 else "negative" if sentiment.polarity < 0 else "neutral"
25
+ }
26
+
27
+ demo = gr.Interface(
28
+ fn=sentiment_analysis,
29
+ inputs=gr.Textbox(placeholder="Enter text to analyze..."),
30
+ outputs=gr.JSON(),
31
+ title="Text Sentiment Analysis",
32
+ description="Analyze the sentiment of the est using TextBlob"
33
+ )
34
+
35
+ if __name__ == "__main__":
36
+ demo.launch(mcp_server=True)
pyproject.toml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "mcp"
3
+ version = "0.1.0"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ dependencies = []
requirements.txt ADDED
File without changes