GChilukala commited on
Commit
8d0cf68
·
1 Parent(s): 57b0860

first-commit

Browse files
Files changed (2) hide show
  1. app.py +30 -0
  2. requirements.txt +87 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from textblob import TextBlob
3
+
4
+ def sentiment_analysis(text:str)->dict:
5
+ """
6
+ Analyze the sentiment of the given text.
7
+ Args:
8
+ text (str): The text to analyze
9
+ Returns:
10
+ dict: A dictionary containing polarity, subjectivity, and assessment
11
+ """
12
+ blob = TextBlob(text)
13
+ sentiment = blob.sentiment
14
+ return {
15
+ "polarity": round(sentiment.polarity, 2), # -1 (negative) to 1 (positive)
16
+ "subjectivity": round(sentiment.subjectivity, 2), # 0 (objective) to 1 (subjective)
17
+ "assessment": "positive" if sentiment.polarity > 0 else "negative" if sentiment.polarity < 0 else "neutral"
18
+ }
19
+
20
+
21
+ demo = gr.Interface(
22
+ fn=sentiment_analysis,
23
+ inputs=gr.Textbox(placeholder="Enter text to analyze..."),
24
+ outputs=gr.JSON(),
25
+ title="Text Sentiment Analysis",
26
+ description="Analyze the sentiment of text using TextBlob"
27
+ )
28
+
29
+ if __name__ == "__main__":
30
+ demo.launch(mcp_server=True)
requirements.txt ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==24.1.0
2
+ aiohappyeyeballs==2.6.1
3
+ aiohttp==3.11.18
4
+ aiosignal==1.3.2
5
+ annotated-types==0.7.0
6
+ anyio==4.9.0
7
+ attrs==25.3.0
8
+ certifi==2025.4.26
9
+ charset-normalizer==3.4.2
10
+ click==8.1.8
11
+ colorama==0.4.6
12
+ distro==1.9.0
13
+ et_xmlfile==2.0.0
14
+ Faker==37.3.0
15
+ fastapi==0.115.12
16
+ ffmpy==0.5.0
17
+ filelock==3.18.0
18
+ frozenlist==1.6.0
19
+ fsspec==2025.3.2
20
+ gradio==5.31.0
21
+ gradio_client==1.10.1
22
+ groovy==0.1.2
23
+ h11==0.16.0
24
+ httpcore==1.0.9
25
+ httpx==0.28.1
26
+ httpx-sse==0.4.0
27
+ huggingface-hub==0.31.2
28
+ idna==3.10
29
+ importlib_metadata==8.7.0
30
+ Jinja2==3.1.6
31
+ jiter==0.9.0
32
+ joblib==1.5.1
33
+ jsonschema==4.23.0
34
+ jsonschema-specifications==2025.4.1
35
+ litellm==1.69.2
36
+ markdown-it-py==3.0.0
37
+ MarkupSafe==3.0.2
38
+ mcp==1.9.0
39
+ mdurl==0.1.2
40
+ multidict==6.4.3
41
+ nltk==3.9.1
42
+ numpy==2.2.6
43
+ openai==1.75.0
44
+ openpyxl==3.1.5
45
+ orjson==3.10.18
46
+ packaging==25.0
47
+ pandas==2.2.3
48
+ pillow==11.2.1
49
+ propcache==0.3.1
50
+ pydantic==2.11.4
51
+ pydantic-settings==2.9.1
52
+ pydantic_core==2.33.2
53
+ pydub==0.25.1
54
+ Pygments==2.19.1
55
+ python-dateutil==2.9.0.post0
56
+ python-dotenv==1.1.0
57
+ python-multipart==0.0.20
58
+ pytz==2025.2
59
+ PyYAML==6.0.2
60
+ referencing==0.36.2
61
+ regex==2024.11.6
62
+ requests==2.32.3
63
+ rich==14.0.0
64
+ rpds-py==0.24.0
65
+ ruff==0.11.11
66
+ safehttpx==0.1.6
67
+ semantic-version==2.10.0
68
+ shellingham==1.5.4
69
+ six==1.17.0
70
+ smolagents==1.15.0
71
+ sniffio==1.3.1
72
+ sse-starlette==2.3.5
73
+ starlette==0.46.2
74
+ textblob==0.19.0
75
+ tiktoken==0.9.0
76
+ tokenizers==0.21.1
77
+ tomlkit==0.13.2
78
+ tqdm==4.67.1
79
+ typer==0.15.4
80
+ typing-inspection==0.4.0
81
+ typing_extensions==4.13.2
82
+ tzdata==2025.2
83
+ urllib3==2.4.0
84
+ uvicorn==0.34.2
85
+ websockets==15.0.1
86
+ yarl==1.20.0
87
+ zipp==3.21.0