alex-abb commited on
Commit
a7e8139
·
verified ·
1 Parent(s): 1774527

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -14
app.py CHANGED
@@ -16,8 +16,17 @@ def analyze_sentiment(text):
16
  output = query({
17
  "inputs": f'''<|begin_of_text|>
18
  <|start_header_id|>system<|end_header_id|>
19
- You're going to deeply analyze the texts I'm going to give you by and you're only going to tell me which category they belong to by answering only the words that correspond to the following categories: for posts that talk about chat models/LLM you'll return "Chatmodel/LLM", for posts that talk about image generation models you'll return "image_generation", for texts that ask for information from the community you'll return "questions".For texts about poeple exposing they recent discovery you'll send "other" but only if what they are talking about don't fit in the previous categories.
20
-
 
 
 
 
 
 
 
 
 
21
  <|eot_id|>
22
  <|start_header_id|>user<|end_header_id|>
23
  {text}
@@ -32,22 +41,39 @@ You're going to deeply analyze the texts I'm going to give you by and you're onl
32
  if isinstance(output, list) and len(output) > 0:
33
  response = output[0].get('generated_text', '').strip().lower()
34
 
35
-
36
  questions = response.count('questions')
37
  ChatmodelLLM = response.count('Chatmodel/LLM')
38
  other = response.count('other')
39
  image_generation = response.count("image_generation")
40
-
41
- if questions == 2:
42
- return 'questions'
43
- elif ChatmodelLLM == 2:
44
- return 'Chat Model/LLM'
45
- elif other == 2 :
46
- return "Other"
47
- elif image_generation == 2 :
48
- return "Image Generation"
49
- else :
50
- return f"Erreur: Réponse ambiguë - '{response}'"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
 
53
  demo = gr.Interface(
 
16
  output = query({
17
  "inputs": f'''<|begin_of_text|>
18
  <|start_header_id|>system<|end_header_id|>
19
+ You're going to deeply analyze the texts I'm going to give you and you're only going to tell me which category they belong to by answering only the words that correspond to the following categories:
20
+ For posts that talk about chat models/LLM, return "Chatmodel/LLM"
21
+ For posts that talk about image generation models, return "image_generation"
22
+ For texts that ask for information from the community, return "questions"
23
+ For posts about fine-tuning or model adjustment, return "fine_tuning"
24
+ For posts related to ethics and bias in AI, return "ethics_bias"
25
+ For posts about datasets and data preparation, return "datasets"
26
+ For posts about tools and libraries, return "tools_libraries"
27
+ For posts containing tutorials and guides, return "tutorials_guides"
28
+ For posts about debugging and problem-solving, return "debugging"
29
+ Respond only with the category name, without any additional explanation or text.
30
  <|eot_id|>
31
  <|start_header_id|>user<|end_header_id|>
32
  {text}
 
41
  if isinstance(output, list) and len(output) > 0:
42
  response = output[0].get('generated_text', '').strip().lower()
43
 
 
44
  questions = response.count('questions')
45
  ChatmodelLLM = response.count('Chatmodel/LLM')
46
  other = response.count('other')
47
  image_generation = response.count("image_generation")
48
+ fine_tuning = response.count("fine_tuning")
49
+ ethics_bias = response.count("ethics_bias")
50
+ datasets = response.count("datasets")
51
+ tools_libraries = response.count("tools_libraries")
52
+ tutorials_guides = response.count("tutorials_guides")
53
+ debugging = response.count("debugging")
54
+
55
+ if questions == 2:
56
+ return 'questions'
57
+ elif ChatmodelLLM == 2:
58
+ return 'Chat Model/LLM'
59
+ elif other == 2:
60
+ return "Other"
61
+ elif image_generation == 2:
62
+ return "Image Generation"
63
+ elif fine_tuning == 2:
64
+ return "Fine-tuning"
65
+ elif ethics_bias == 2:
66
+ return "Ethics and Bias"
67
+ elif datasets == 2:
68
+ return "Datasets"
69
+ elif tools_libraries == 2:
70
+ return "Tools and Libraries"
71
+ elif tutorials_guides == 2:
72
+ return "Tutorials and Guides"
73
+ elif debugging == 2:
74
+ return "Debugging"
75
+ else :
76
+ return f"Erreur: Réponse ambiguë - '{response}'"
77
 
78
 
79
  demo = gr.Interface(