Spaces:
Sleeping
Sleeping
solving the conditional problem
Browse files
app.py
CHANGED
@@ -3,17 +3,21 @@ import os
|
|
3 |
|
4 |
from inference import Inference
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
if __name__ == "__main__":
|
7 |
-
|
8 |
-
|
9 |
-
interface = gr.Interface(
|
10 |
-
fn=inference.inference,
|
11 |
-
inputs=gr.Blocks([
|
12 |
-
gr.Dropdown(choices=["Model 1", "Model 2", "Model 3"], label="Models", info="Select the model to use..", ),
|
13 |
-
gr.Image(type="pil", value=os.path.join(os.path.dirname(__file__), "617.jpg")),
|
14 |
-
gr.Textbox(label="Insert a question..", lines=2),
|
15 |
-
gr.Button(value="Submit")
|
16 |
-
]),
|
17 |
-
outputs="text"
|
18 |
-
)
|
19 |
-
interface.launch()
|
|
|
3 |
|
4 |
from inference import Inference
|
5 |
|
6 |
+
inference = Inference()
|
7 |
+
|
8 |
+
|
9 |
+
with gr.Blocks() as block:
|
10 |
+
options = gr.Dropdown(choices=["Model 1", "Model 2", "Model 3"], label="Models", info="Select the model to use..", )
|
11 |
+
# need to improve this one...
|
12 |
+
|
13 |
+
txt = gr.Textbox(label="Insert a question..", lines=2)
|
14 |
+
txt_3 = gr.Textbox(value="", label="Your answer is here..")
|
15 |
+
btn = gr.Button(value="Submit")
|
16 |
+
|
17 |
+
dogs = os.path.join(os.path.dirname(__file__), "617.jpg")
|
18 |
+
image = gr.Image(type="pil", value=dogs)
|
19 |
+
|
20 |
+
btn.click(inference.inference, inputs=[options, image, txt], outputs=[txt_3])
|
21 |
+
|
22 |
if __name__ == "__main__":
|
23 |
+
block.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|