Mrahsanahmad's picture
download file
3614f1d
raw
history blame
661 Bytes
import gradio as gr
import requests
import re
def getFilename_fromCd(cd):
"""
Get filename from content-disposition
"""
if not cd:
return None
fname = re.findall('filename=(.+)', cd)
if len(fname) == 0:
return None
return fname[0]
def downloadVith():
print("starting download")
url = 'https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth'
r = requests.get(url, allow_redirects=True)
open("sam_vit_h_4b8939.pth", 'wb').write(r.content)
def greet(name):
downloadVith()
return "Hello " + name + "!!"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()