File size: 372 Bytes
6f7a32a
 
66319e8
 
 
 
 
 
 
 
6f7a32a
 
66319e8
 
 
 
6f7a32a
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr

code = """
abc
```py
def test(x):
  return x
```
"""

def generate(x):
    return [
        (f"abc ![](/file={x}) klm ![](/file={x})", "def"),
        ("ghi", "jkl"),
        (f"abc ![](/file={x}) klm", "def"),        
    ]


with gr.Blocks() as demo:
    i = gr.Image(type="filepath")
    c = gr.Chatbot()
    i.change(generate, i, c)

demo.launch()