am commited on
Commit
3431d22
·
1 Parent(s): 34c13c1
Files changed (1) hide show
  1. app.py +25 -14
app.py CHANGED
@@ -114,16 +114,21 @@ def model_inference(
114
  yield buffer
115
 
116
 
 
 
 
 
 
117
 
118
 
119
- with gr.Blocks(fill_height=True) as demo:
120
 
121
  send_btn = gr.Button("Send", variant="primary", render=False)
122
  textbox = gr.Textbox(show_label=False, placeholder="Enter your text here and press ENTER", render=False, submit_btn="Send")
123
  # chatbot = gr.Chatbot(type="messages", label="AI", render_markdown=True, sanitize_html=False, allow_tags=True, height=800, container=False, show_share_button=False)
124
 
125
  with gr.Row():
126
- with gr.Column(scale=4):
127
  # input_type_radio = gr.Radio(choices=["Image", "Video"], value="Image", label="Select Input Type")
128
  image_input = gr.Image(type="pil", visible=True, sources="upload", show_label=False)
129
 
@@ -139,18 +144,24 @@ with gr.Blocks(fill_height=True) as demo:
139
  inputs=[image_input, textbox],
140
  )
141
 
142
- with gr.Column(scale=7):
143
-
144
- chat_interface = gr.ChatInterface(fn=model_inference,
145
- # title='title', description='description',
146
- type="messages",
147
- # chatbot=gr.Chatbot(type="messages", label="AI", render_markdown=True, sanitize_html=False, allow_tags=True, height=800, container=False, show_share_button=False),
148
- chatbot=gr.Chatbot(type="messages", label="AI", render_markdown=True, sanitize_html=False, allow_tags=True, autoscroll=True, scale=1, container=False, show_share_button=False),
149
- textbox=textbox,
150
- additional_inputs=image_input,
151
- multimodal=False,
152
- fill_height=True,
153
- )
 
 
 
 
 
 
154
 
155
  # Clear chat history when an example is selected (keep example-populated inputs intact)
156
  ex.load_input_event.then(
 
114
  yield buffer
115
 
116
 
117
+ # CSS = """
118
+ # .contain { display: flex; flex-direction: column; }
119
+ # #component-0 { height: 100%; }
120
+ # #chatbot { flex-grow: 1; height: 600px; } /* Set height here */
121
+ # """
122
 
123
 
124
+ with gr.Blocks() as demo:
125
 
126
  send_btn = gr.Button("Send", variant="primary", render=False)
127
  textbox = gr.Textbox(show_label=False, placeholder="Enter your text here and press ENTER", render=False, submit_btn="Send")
128
  # chatbot = gr.Chatbot(type="messages", label="AI", render_markdown=True, sanitize_html=False, allow_tags=True, height=800, container=False, show_share_button=False)
129
 
130
  with gr.Row():
131
+ with gr.Column(scale=0.5):
132
  # input_type_radio = gr.Radio(choices=["Image", "Video"], value="Image", label="Select Input Type")
133
  image_input = gr.Image(type="pil", visible=True, sources="upload", show_label=False)
134
 
 
144
  inputs=[image_input, textbox],
145
  )
146
 
147
+ # with gr.Column(scale=7):
148
+
149
+ chat_interface = gr.ChatInterface(fn=model_inference,
150
+ # title='title', description='description',
151
+ type="messages",
152
+ chatbot=gr.Chatbot(type="messages", label="AI", render_markdown=True, sanitize_html=False, allow_tags=True, height='40vw', container=False, show_share_button=False),
153
+ # chatbot=gr.Chatbot(type="messages", label="AI", render_markdown=True, sanitize_html=False, allow_tags=True, scale=1, show_share_button=False),
154
+ textbox=textbox,
155
+ additional_inputs=image_input,
156
+ multimodal=False,
157
+ fill_height=False,
158
+ # css=CSS,
159
+ )
160
+ # chat_interface.chatbot.render_markdown=True
161
+ # chat_interface.chatbot.sanitize_html=False
162
+ # chat_interface.chatbot.allow_tags=True
163
+ # chat_interface.chatbot.elem_id="chatbot"
164
+
165
 
166
  # Clear chat history when an example is selected (keep example-populated inputs intact)
167
  ex.load_input_event.then(