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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -83,17 +83,24 @@ def process_audio_text(text, audio):
83
 
84
  # 处理音频输入
85
  audio_path = process_audio_input(audio)
 
 
 
 
 
86
 
87
- text = "" if not isinstance(text, str) else text
 
 
 
 
 
 
 
 
88
 
89
  tmp = [{
90
- "conversations": [
91
- {
92
- "from": "user",
93
- "value": text,
94
- "audio": audio_path
95
- }
96
- ]
97
  }]
98
 
99
  accumulated_text = ""
 
83
 
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 = ""