Files changed (2) hide show
  1. app.py +0 -39
  2. requirements.txt +0 -2
app.py DELETED
@@ -1,39 +0,0 @@
1
- import json
2
- import gradio as gr
3
- from textblob import TextBlob
4
-
5
- def sentiment_analysis(text: str) -> str:
6
- """
7
- Analyze the sentiment of the given text.
8
-
9
- Args:
10
- text (str): The text to anlyze
11
-
12
- Returns:
13
- str: A JSON string containing polarity, subjectivity, and assessment
14
- """
15
- blob = TextBlob(text)
16
- sentiment = blob.sentiment
17
-
18
- result = {
19
- "polority": round(sentiment.polarity, 2), # -1 to 1
20
- "subjectivity" : round(sentiment.subjectivity, 2), # 0 to 1
21
- "assessment" : "positivity" if sentiment.polarity > 0 else "negative" if sentiment.polarity < 0 else "neutral"
22
- }
23
-
24
- return json.dumps(result)
25
-
26
-
27
- # Create the Gradio interface
28
- demo = gr.Interface(
29
- fn=sentiment_analysis,
30
- inputs=gr.Textbox(placeholder="Enter text to analyze..."),
31
- outputs=gr.Textbox(),
32
- title="Text Sentiment Analysis",
33
- description="Analyze the sentiment of text using TextBlob"
34
- )
35
-
36
- # Launch the interface and MCP server
37
-
38
- if __name__ == "__main__":
39
- demo.launch(mcp_server=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt DELETED
@@ -1,2 +0,0 @@
1
- gradio[mcp]
2
- textblob