Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,11 +2,11 @@ import os
|
|
2 |
import uuid
|
3 |
import gradio as gr
|
4 |
import openai
|
5 |
-
import whisper
|
6 |
import pdfplumber
|
7 |
import docx
|
8 |
import pandas as pd
|
9 |
from PIL import Image
|
|
|
10 |
|
11 |
# ====== UTILS SECTION ======
|
12 |
def extract_text_from_file(file):
|
@@ -74,10 +74,10 @@ def process_message_with_files(message, file, audio, chat_history):
|
|
74 |
full_message = "\n".join(filter(None, [message, file_text, audio_text]))
|
75 |
|
76 |
if not full_message.strip():
|
77 |
-
return chat_history,
|
78 |
|
79 |
reply = generate_reply_with_context(chat_history, full_message)
|
80 |
-
chat_history.append(("user", message))
|
81 |
chat_history.append(("assistant", reply))
|
82 |
return chat_history, "", None, None, "Response generated."
|
83 |
|
|
|
2 |
import uuid
|
3 |
import gradio as gr
|
4 |
import openai
|
|
|
5 |
import pdfplumber
|
6 |
import docx
|
7 |
import pandas as pd
|
8 |
from PIL import Image
|
9 |
+
import whisper
|
10 |
|
11 |
# ====== UTILS SECTION ======
|
12 |
def extract_text_from_file(file):
|
|
|
74 |
full_message = "\n".join(filter(None, [message, file_text, audio_text]))
|
75 |
|
76 |
if not full_message.strip():
|
77 |
+
return chat_history, message, None, None, "Please enter a message or upload a file/audio."
|
78 |
|
79 |
reply = generate_reply_with_context(chat_history, full_message)
|
80 |
+
chat_history.append(("user", message.strip() or file_text or audio_text))
|
81 |
chat_history.append(("assistant", reply))
|
82 |
return chat_history, "", None, None, "Response generated."
|
83 |
|