osanseviero HF staff commited on
Commit
acb7417
1 Parent(s): c676521

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -33,6 +33,7 @@ def format_classname(classname):
33
 
34
  def audio_tag(
35
  audio_path,
 
36
  sample_rate=32000,
37
  window_size=800,
38
  hop_size=320,
@@ -59,11 +60,11 @@ def audio_tag(
59
  # Print audio tagging top probabilities
60
 
61
  label = labels[sorted_indexes[0]]
62
- return formatted_message(format_classname(label))
63
 
64
 
65
 
66
- def formatted_message(audio_class):
67
  if cached_audio_class != audio_class:
68
  cached_audio_class = audio_class
69
  prefix = f"""You are going to act as a magical tool that allows for humans to communicate with non-human entities like
@@ -107,13 +108,16 @@ def formatted_message(audio_class):
107
 
108
  demo = gr.Interface(
109
  audio_tag,
110
- gr.Audio(source="upload", type="filepath", label="Your audio"),
 
 
 
111
  gr.Textbox(),
112
  title="AnyChat",
113
  description="""
114
  <div style='text-align: center; width:100%; margin: auto;'>
115
- <img src='./logo.png' alt='anychat' />
116
  <h3>Non-Human entities have many things to say, listen to them!</h3>
117
  </div>
118
- """),
119
  ).launch(debug=True)
 
33
 
34
  def audio_tag(
35
  audio_path,
36
+ human_input,
37
  sample_rate=32000,
38
  window_size=800,
39
  hop_size=320,
 
60
  # Print audio tagging top probabilities
61
 
62
  label = labels[sorted_indexes[0]]
63
+ return formatted_message(format_classname(label), human_input)
64
 
65
 
66
 
67
+ def formatted_message(audio_class, human_input):
68
  if cached_audio_class != audio_class:
69
  cached_audio_class = audio_class
70
  prefix = f"""You are going to act as a magical tool that allows for humans to communicate with non-human entities like
 
108
 
109
  demo = gr.Interface(
110
  audio_tag,
111
+ [
112
+ gr.Audio(source="upload", type="filepath", label="Your audio"),
113
+ gr.Textbox(),
114
+ ],
115
  gr.Textbox(),
116
  title="AnyChat",
117
  description="""
118
  <div style='text-align: center; width:100%; margin: auto;'>
119
+ <img src='./logo.png' alt='anychat' width='250px' />
120
  <h3>Non-Human entities have many things to say, listen to them!</h3>
121
  </div>
122
+ """,
123
  ).launch(debug=True)