merve HF staff commited on
Commit
ddb7329
1 Parent(s): a32f7ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -14
app.py CHANGED
@@ -22,28 +22,37 @@ t2t_example = [["Paraphrase: Bu üründen çok memnun kaldım."]]
22
  nli_example = [["Bunu çok beğendim. Bunu çok sevdim."]]
23
 
24
 
25
- t2t_gen_model = pipeline(model="boun-tabi-LMG/TURNA", device=0)
26
-
27
-
28
- ttc = pipeline(model="boun-tabi-LMG/turna_classification_ttc4900", device=0)
29
  # examples =long_text, title="Text Categorization")
30
- product_reviews = pipeline(model="boun-tabi-LMG/turna_classification_tr_product_reviews", device=0)
31
- # examples=sentiment_example, title="Product Reviews Categorization")
32
- title_gen = pipeline(model="boun-tabi-LMG/turna_title_generation_mlsum", device=0)
33
- # examples =long_text, title="Title Generation", description="Enter a text to generate title to.")
34
- sentiment_model = pipeline(model="boun-tabi-LMG/turna_classification_17bintweet_sentiment", device=0)
35
- #examples=sentiment_example, title="Sentiment Analysis", description="Enter a text to generate title to.")
36
 
37
 
38
- nli_model = pipeline(model="boun-tabi-LMG/turna_nli_nli_tr", device=0)
 
 
 
39
 
40
- stsb_model = pipeline(model="boun-tabi-LMG/turna_semantic_similarity_stsb_tr", device=0)
 
 
 
41
 
 
 
 
 
42
 
 
 
 
 
43
 
44
  @spaces.GPU
45
- def sentiment_analysis(input, sentiment=True):
46
- if sentiment==True:
 
 
47
  return sentiment_model(input)
48
  else:
49
  return product_reviews(input)
 
22
  nli_example = [["Bunu çok beğendim. Bunu çok sevdim."]]
23
 
24
 
25
+ #ttc = pipeline(model="boun-tabi-LMG/turna_classification_ttc4900", device=0)
 
 
 
26
  # examples =long_text, title="Text Categorization")
27
+ #product_reviews = pipeline(model="boun-tabi-LMG/turna_classification_tr_product_reviews", device=0)
28
+ #title_gen = pipeline(model="boun-tabi-LMG/turna_title_generation_mlsum", device=0)
 
 
 
 
29
 
30
 
31
+ @spaces.GPU
32
+ def nli(input, model_choice="turna_nli_nli_tr"):
33
+ nli_model = pipeline(model="boun-tabi-LMG/turna_nli_nli_tr", device=0)
34
+ stsb_model = pipeline(model="boun-tabi-LMG/turna_semantic_similarity_stsb_tr", device=0)
35
 
36
+ if model_choice=="turna_nli_nli_tr":
37
+ return nli_model(input)
38
+ else:
39
+ return stsb_model(input)
40
 
41
+ @spaces.GPU
42
+ def nli(input, model_choice="turna_nli_nli_tr"):
43
+ nli_model = pipeline(model="boun-tabi-LMG/turna_nli_nli_tr", device=0)
44
+ stsb_model = pipeline(model="boun-tabi-LMG/turna_semantic_similarity_stsb_tr", device=0)
45
 
46
+ if model_choice=="turna_nli_nli_tr":
47
+ return nli_model(input)
48
+ else:
49
+ return stsb_model(input)
50
 
51
  @spaces.GPU
52
+ def sentiment_analysis(input, model_choice="turna_classification_17bintweet_sentiment"):
53
+ product_reviews = pipeline(model="boun-tabi-LMG/turna_classification_tr_product_reviews", device=0)
54
+ sentiment_model = pipeline(model="boun-tabi-LMG/turna_classification_17bintweet_sentiment", device=0)
55
+ if model_choice=="turna_classification_17bintweet_sentiment":
56
  return sentiment_model(input)
57
  else:
58
  return product_reviews(input)