Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from PIL import Image
|
3 |
from inference.main import MultiModalPhi2
|
|
|
4 |
|
5 |
messages = []
|
6 |
|
@@ -51,11 +52,15 @@ def run(history, text, image, audio_upload, audio_mic):
|
|
51 |
print("image", image)
|
52 |
print("audio", audio)
|
53 |
|
54 |
-
|
55 |
-
image
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
58 |
|
|
|
59 |
history.append((None, outputs.title()))
|
60 |
return history, None, None, None, None
|
61 |
|
|
|
1 |
import gradio as gr
|
2 |
from PIL import Image
|
3 |
from inference.main import MultiModalPhi2
|
4 |
+
import base64
|
5 |
|
6 |
messages = []
|
7 |
|
|
|
52 |
print("image", image)
|
53 |
print("audio", audio)
|
54 |
|
55 |
+
try:
|
56 |
+
if image is not None:
|
57 |
+
image_data = base64.b64decode(image.split(",")[1])
|
58 |
+
image = Image.open(BytesIO(image_data))
|
59 |
+
except Exception as e:
|
60 |
+
print(f"Error decoding image: {e}")
|
61 |
+
image = None
|
62 |
|
63 |
+
outputs = multimodal_phi2(text, audio, image)
|
64 |
history.append((None, outputs.title()))
|
65 |
return history, None, None, None, None
|
66 |
|