Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
import google.generativeai as genai
|
|
|
|
|
|
|
|
|
|
| 4 |
"""
|
| 5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 6 |
"""
|
|
@@ -24,7 +27,7 @@ def respond(
|
|
| 24 |
print (message,image)
|
| 25 |
## for image
|
| 26 |
if isinstance(image, np.ndarray):
|
| 27 |
-
|
| 28 |
else:
|
| 29 |
try:
|
| 30 |
img = PIL.Image.open(image)
|
|
@@ -60,6 +63,7 @@ demo = gr.ChatInterface(
|
|
| 60 |
gr.Image(show_label=False)
|
| 61 |
],
|
| 62 |
additional_inputs_accordion=gr.Accordion(open=True),
|
|
|
|
| 63 |
)
|
| 64 |
|
| 65 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
import google.generativeai as genai
|
| 4 |
+
import numpy as np
|
| 5 |
+
import PIL.Image
|
| 6 |
+
import io, os
|
| 7 |
"""
|
| 8 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 9 |
"""
|
|
|
|
| 27 |
print (message,image)
|
| 28 |
## for image
|
| 29 |
if isinstance(image, np.ndarray):
|
| 30 |
+
img = PIL.Image.fromarray(image)
|
| 31 |
else:
|
| 32 |
try:
|
| 33 |
img = PIL.Image.open(image)
|
|
|
|
| 63 |
gr.Image(show_label=False)
|
| 64 |
],
|
| 65 |
additional_inputs_accordion=gr.Accordion(open=True),
|
| 66 |
+
theme=gr.themes.Soft()
|
| 67 |
)
|
| 68 |
|
| 69 |
|