echung682 commited on
Commit
bba4822
·
verified ·
1 Parent(s): 030538b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -16
app.py CHANGED
@@ -86,21 +86,23 @@ def displayResults():
86
 
87
  return plt
88
 
89
- # Get user consent for webcam access
90
- print(Fore.GREEN + "This program will analyze your text for emotions and use your webcame to detect your emotions from your face. Do you give consent? (yes/no): ")
91
- consent = input()
92
-
93
- if (consent.lower() == 'yes'):
94
- # Create Gradio interface with both text output and plot visualization
95
- interface = gr.Interface(
96
- fn=emotionAnalysis,
97
- inputs=["text"],
98
- outputs=[
99
- gr.Text(label="Emotion Results"), # Shows current emotion analysis
100
- gr.Plot(label="Emotion Timeline") # Shows emotion trends over time
101
- ],
102
- title="Emotion Analysis from Text and Face",
103
- description="Enter text into the textbox. Then, press 'Submit' or 'Enter' to activate the webcam. Wait and see the results."
104
  )
 
 
 
 
 
 
 
 
105
 
106
- interface.launch()
 
 
 
86
 
87
  return plt
88
 
89
+ # Create Gradio interface with consent notice in the description
90
+ interface = gr.Interface(
91
+ fn=emotionAnalysis,
92
+ inputs=[
93
+ gr.Textbox(
94
+ label="Enter your text",
95
+ placeholder="Type your message here. Type 'quit' to see final results."
 
 
 
 
 
 
 
 
96
  )
97
+ ],
98
+ outputs=[
99
+ gr.Text(label="Emotion Results"),
100
+ gr.Plot(label="Emotion Timeline")
101
+ ],
102
+ title="Emotion Analysis from Text and Face",
103
+ description="⚠️ This application will use your webcam to detect facial emotions. By using this app, you consent to webcam access. Type text and press Enter to analyze both text and facial emotions."
104
+ )
105
 
106
+ # Launch the interface
107
+ if __name__ == "__main__":
108
+ interface.launch()