Rahatara commited on
Commit
21ac5a1
·
verified ·
1 Parent(s): 73d5fa3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -37,12 +37,6 @@ safety_settings = {
37
  HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE,
38
  }
39
 
40
-
41
-
42
-
43
-
44
-
45
-
46
  # Prompt the model to generate content
47
 
48
  # Function to analyze text
@@ -54,19 +48,26 @@ def analyze_text(text):
54
  generation_config=generation_config,
55
  safety_settings=safety_settings,)
56
  return response.text if response else "No response generated."
 
 
 
 
 
 
 
 
 
57
 
58
- # Gradio interface setup
59
  with gr.Blocks() as app:
60
  with gr.Tab("Text Analysis"):
61
  text_input = gr.Textbox(label="Enter Text", placeholder="Type here...", lines=4)
62
  analyze_text_btn = gr.Button("Analyze Text")
63
  text_output = gr.Textbox(label="Analysis Output", lines=6)
 
64
  analyze_text_btn.click(
65
  fn=analyze_text,
66
  inputs=text_input,
67
  outputs=text_output
68
  )
69
-
70
-
71
-
72
  app.launch()
 
37
  HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE,
38
  }
39
 
 
 
 
 
 
 
40
  # Prompt the model to generate content
41
 
42
  # Function to analyze text
 
48
  generation_config=generation_config,
49
  safety_settings=safety_settings,)
50
  return response.text if response else "No response generated."
51
+ # Define example scenarios
52
+ example_scenarios = [
53
+ "During a team meeting, I noticed that whenever a female colleague tried to express her opinion, she was often interrupted or talked over by male colleagues. Her contributions were rarely acknowledged, whereas comments from male counterparts received immediate attention and discussion.",
54
+ "In the performance reviews, it seems that the feedback given to female employees often focuses more on their demeanor and less on their actual accomplishments compared to their male colleagues. Terms like 'bossy' and 'emotional' are frequently used in the evaluations of women, unlike in the reviews for men.",
55
+ "I have observed that male employees are more frequently considered for promotions and challenging projects, even when female employees have similar or superior qualifications. Discussions about career advancement opportunities with female staff often also include considerations about family life and children, which is not the case with male staff.",
56
+ "During a hiring panel, I noticed a difference in how male and female candidates were questioned. Female candidates were often asked about their personal life, family plans, and how they would balance home and work. Such questions were not posed to male candidates.",
57
+ "In informal discussions among employees, it was revealed that there are significant wage discrepancies between male and female employees who hold the same position and possess comparable experience and skills.",
58
+ "Some male colleagues often make jokes or comments about female employees' appearances and attire, which seems to create an uncomfortable environment. Despite complaints, the issue has not been adequately addressed by management."
59
+ ]
60
 
61
+ # Gradio app setup
62
  with gr.Blocks() as app:
63
  with gr.Tab("Text Analysis"):
64
  text_input = gr.Textbox(label="Enter Text", placeholder="Type here...", lines=4)
65
  analyze_text_btn = gr.Button("Analyze Text")
66
  text_output = gr.Textbox(label="Analysis Output", lines=6)
67
+ examples = gr.Examples(examples=example_scenarios, inputs=text_input, fn=analyze_text, outputs=text_output)
68
  analyze_text_btn.click(
69
  fn=analyze_text,
70
  inputs=text_input,
71
  outputs=text_output
72
  )
 
 
 
73
  app.launch()