Mark0047 commited on
Commit
80d6d93
·
verified ·
1 Parent(s): d3d8d10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  from transformers import pipeline
3
 
4
  # Load the Hugging Face model
5
- emotion_classifier = pipeline("text-classification", model="SamLowe/roberta-base-go_emotions", return_all_scores=True)
6
 
7
  # Define a function to process the transcribed text with the emotion model
8
  def transcribe_and_analyze(audio):
@@ -16,7 +16,7 @@ def transcribe_and_analyze(audio):
16
  # Create Gradio interface
17
  interface = gr.Interface(
18
  fn=transcribe_and_analyze,
19
- inputs=gr.Audio(source="microphone", type="filepath"), # Accept audio input
20
  outputs=[
21
  gr.Textbox(label="Transcription"), # Show the transcription
22
  gr.JSON(label="Emotion Analysis") # Show the emotion analysis
 
2
  from transformers import pipeline
3
 
4
  # Load the Hugging Face model
5
+ emotion_classifier = pipeline("text-classification", model="SamLowe/roberta-base-go_emotions", top_k=None)
6
 
7
  # Define a function to process the transcribed text with the emotion model
8
  def transcribe_and_analyze(audio):
 
16
  # Create Gradio interface
17
  interface = gr.Interface(
18
  fn=transcribe_and_analyze,
19
+ inputs=gr.Audio(type="filepath"), # Accept audio input (fixed)
20
  outputs=[
21
  gr.Textbox(label="Transcription"), # Show the transcription
22
  gr.JSON(label="Emotion Analysis") # Show the emotion analysis