sayedM commited on
Commit
4c26d71
·
1 Parent(s): 076f339

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -103,6 +103,21 @@ description_html = """
103
  """
104
  title = "autoannotation"
105
 
106
-
107
- # Launch the Gradio interface with the description below it
108
- gr.Interface(fn=get_results, inputs=[image_input, text_input], outputs=outputs,title=title, description=description_html).launch(share=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  """
104
  title = "autoannotation"
105
 
106
+ description = "This is a project description. It demonstrates how to use Gradio with an image and text input to interact with an API."
107
+
108
+ # Create a Blocks object and use it as a context manager
109
+ with gr.Blocks() as demo:
110
+ # Define the input components and add them to the layout
111
+ with gr.Row():
112
+ image_input = gr.inputs.Image()
113
+ text_input = gr.inputs.Textbox(label="Prompt")
114
+ button = gr.Button("Run")
115
+ # Define the output component and add it to the layout
116
+ with gr.Row():
117
+ output = gr.Image(type="numpy", label="Output Image")
118
+ # Define the event listener that connects the input and output components and triggers the function
119
+ button.click(fn=get_results, inputs=[image_input, text_input], outputs=output, api_name="get_results")
120
+ # Add the description below the layout
121
+ gr.Markdown(description)
122
+ # Launch the app
123
+ demo.launch(share=False)