Spaces:
Sleeping
Sleeping
File size: 787 Bytes
d2a63c1 f53a2aa d2a63c1 49f9a57 c5797b7 d2a63c1 cece4fa ad1c334 79c1479 9c010ec c8027b7 79c1479 cece4fa 49f9a57 a2b3a50 c8027b7 cece4fa 79c1479 cece4fa f53a2aa cece4fa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import gradio as gr
import os
from PIL import Image
from inference import Inference
inference = Inference()
with gr.Blocks() as block:
options = gr.Dropdown(choices=["Blip Saffal", "Blip CN"], label="Models", info="Select the model to use..", )
# need to improve this one...
txt = gr.Textbox(label="Insert a question...", lines=2)
txt_3 = gr.Textbox(value="", label="Your answer is here..")
btn = gr.Button(value="Submit")
frame_path = os.path.join(os.path.dirname(__file__), "testing.jpg")
frame = Image.open(frame_path)
inference.logger.info(f"Image loaded {frame.size}")
image = gr.Image(type="pil", value=frame)
btn.click(inference.inference, inputs=[options, image, txt], outputs=[txt_3])
if __name__ == "__main__":
block.launch() |