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