aashraychegu commited on
Commit
9c87c9c
·
1 Parent(s): aed8175

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -23,13 +23,13 @@ headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit
23
  "Upgrade-Insecure-Requests": "1",}
24
 
25
  def greet():
26
- print("in greet")
27
- session = requests.Session()
28
- with open("./img.jpg","wb+") as f:
29
- f.write(session.get(url,headers = headers).content)
30
 
31
  with gr.Blocks() as iface:
32
  btn = gr.Button("Run")
33
- btn.click(fn=greet)
 
34
 
35
  iface.launch()
 
23
  "Upgrade-Insecure-Requests": "1",}
24
 
25
  def greet():
26
+ img = requests.get(url,headers = headers).content
27
+ print(img.decode("ascii"))
28
+ return Image.open(BytesIO(binascii.unhexlify(img)))
 
29
 
30
  with gr.Blocks() as iface:
31
  btn = gr.Button("Run")
32
+ img = gr.Image(type = "PIL")
33
+ btn.click(fn=greet,outputs = [img])
34
 
35
  iface.launch()