tzzte commited on
Commit
a7eeceb
·
verified ·
1 Parent(s): f8c9676

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -19
app.py CHANGED
@@ -84,23 +84,16 @@ def process_audio_text(text, audio):
84
  # 处理音频输入
85
  audio_path = process_audio_input(audio)
86
 
87
- # 检查是否有输入
88
- if not text and not audio_path:
89
- yield "Please provide either text or audio input.", None
90
- return
91
-
92
- # 构建对话输入
93
- conversation = {
94
- "from": "user",
95
- "value": text if text else ""
96
- }
97
 
98
- # 如果有音频,添加到对话中
99
- if audio_path:
100
- conversation["audio"] = audio_path
101
-
102
  tmp = [{
103
- "conversations": [conversation]
 
 
 
 
 
 
104
  }]
105
 
106
  accumulated_text = ""
@@ -130,14 +123,14 @@ init_model()
130
 
131
  if __name__ == "__main__":
132
  examples = [
133
- ["", "./show_case/1.wav"],
134
- ["", "./show_case/2.wav"],
135
  ]
136
 
137
  iface = gr.Interface(
138
  fn=process_audio_text,
139
  inputs=[
140
- gr.Textbox(label="Enter text instruction", value=""),
141
  gr.Audio(type="filepath", label="Upload Audio")
142
  ],
143
  outputs=[
@@ -149,4 +142,4 @@ if __name__ == "__main__":
149
  allow_flagging="never"
150
  )
151
 
152
- iface.launch(server_name="0.0.0.0", server_port=7860)
 
84
  # 处理音频输入
85
  audio_path = process_audio_input(audio)
86
 
87
+ text = ""
 
 
 
 
 
 
 
 
 
88
 
 
 
 
 
89
  tmp = [{
90
+ "conversations": [
91
+ {
92
+ "from": "user",
93
+ "value": text,
94
+ "audio": audio_path
95
+ }
96
+ ]
97
  }]
98
 
99
  accumulated_text = ""
 
123
 
124
  if __name__ == "__main__":
125
  examples = [
126
+ ["./show_case/1.wav"],
127
+ ["./show_case/2.wav"],
128
  ]
129
 
130
  iface = gr.Interface(
131
  fn=process_audio_text,
132
  inputs=[
133
+ # gr.Textbox(label="Enter text instruction", value=""),
134
  gr.Audio(type="filepath", label="Upload Audio")
135
  ],
136
  outputs=[
 
142
  allow_flagging="never"
143
  )
144
 
145
+ iface.launch(server_name="0.0.0.0", server_port=7860, share=False)