tahamueed23 commited on
Commit
a91f5ae
·
verified ·
1 Parent(s): 82a1819

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -9,31 +9,25 @@ import re
9
  # -----------------------------
10
  english_model = pipeline(
11
  "sentiment-analysis",
12
- model="cardiffnlp/twitter-roberta-base-sentiment-latest"
13
  )
14
 
15
  # Replace with your own fine-tuned models
16
  urdu_model = pipeline(
17
  "sentiment-analysis",
18
- model="tahamueed23/urdu-roman-urdu-sentiment"
19
  )
20
 
21
  roman_urdu_model = pipeline(
22
  "sentiment-analysis",
23
- model="tahamueed23/urdu-roman-urdu-sentiment"
24
  )
25
 
26
- # -----------------------------
27
- # CSV Setup
28
- # -----------------------------
29
  SAVE_FILE = "sentiment_logs.csv"
30
  if not os.path.exists(SAVE_FILE):
31
  df = pd.DataFrame(columns=["Sentence", "Language", "Sentiment", "Confidence"])
32
  df.to_csv(SAVE_FILE, index=False)
33
 
34
- # -----------------------------
35
- # Language Detection (simple rule-based)
36
- # -----------------------------
37
  def detect_language(text):
38
  urdu_chars = set("ابتثجحخدذرزسشصضطظعغفقکلمنوہیءآؤئۀ")
39
  if any(ch in urdu_chars for ch in text):
 
9
  # -----------------------------
10
  english_model = pipeline(
11
  "sentiment-analysis",
12
+ model="siebert/sentiment-roberta-large-english"
13
  )
14
 
15
  # Replace with your own fine-tuned models
16
  urdu_model = pipeline(
17
  "sentiment-analysis",
18
+ model="tahamueed23/fine_tuned_cardiffnlp_urdu_and_roman-urdu"
19
  )
20
 
21
  roman_urdu_model = pipeline(
22
  "sentiment-analysis",
23
+ model="tahamueed23/fine_tuned_cardiffnlp_urdu_and_roman-urdu"
24
  )
25
 
 
 
 
26
  SAVE_FILE = "sentiment_logs.csv"
27
  if not os.path.exists(SAVE_FILE):
28
  df = pd.DataFrame(columns=["Sentence", "Language", "Sentiment", "Confidence"])
29
  df.to_csv(SAVE_FILE, index=False)
30
 
 
 
 
31
  def detect_language(text):
32
  urdu_chars = set("ابتثجحخدذرزسشصضطظعغفقکلمنوہیءآؤئۀ")
33
  if any(ch in urdu_chars for ch in text):