HinaCortus commited on
Commit
23ba778
1 Parent(s): 53f286f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -48,9 +48,17 @@ def TopicClassification(payload: TextIn):
48
  result = nlp(text, truncation=True)
49
  return {"result": result}
50
 
51
-
52
  @app.get("/whichsocial/{request}")
53
  def whichsocial(request):
 
 
 
 
 
 
 
 
54
  socialnetwork = 'TikTok'
55
  userprofile = 'me'
56
- return {"request": request, "social_network": socialnetwork, "user_profile": userprofile}
 
48
  result = nlp(text, truncation=True)
49
  return {"result": result}
50
 
51
+ # https://hinacortus-api-knowyouraudience.hf.space/whichsocial/myspace
52
  @app.get("/whichsocial/{request}")
53
  def whichsocial(request):
54
+ if ('http' in request or 'https' in request or 'www' in request or '.com' in request or '.fr' in request:
55
+ request = "website"
56
+ listsocialnetwork = ['facebook', 'youtube', 'myspace', 'linkedin', 'twitter', 'instagram', 'github',
57
+ 'reddit', 'picterest', 'discord', '']
58
+ link_split = request.split('/')
59
+ for part in link_split:
60
+ if part in listsocialnetwork:
61
+ website = "found"
62
  socialnetwork = 'TikTok'
63
  userprofile = 'me'
64
+ return {"request": request, "website":website, "social_network": socialnetwork, "user_profile": userprofile}