Spaces:
Runtime error
Runtime error
Mrahsanahmad
commited on
Commit
•
7f69cfa
1
Parent(s):
3614f1d
Revert "download file"
Browse filesThis reverts commit 3614f1d152c52b017cbc63d6ec258d101cce9372.
app.py
CHANGED
@@ -1,26 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
-
import requests
|
3 |
-
import re
|
4 |
-
|
5 |
-
def getFilename_fromCd(cd):
|
6 |
-
"""
|
7 |
-
Get filename from content-disposition
|
8 |
-
"""
|
9 |
-
if not cd:
|
10 |
-
return None
|
11 |
-
fname = re.findall('filename=(.+)', cd)
|
12 |
-
if len(fname) == 0:
|
13 |
-
return None
|
14 |
-
return fname[0]
|
15 |
-
|
16 |
-
def downloadVith():
|
17 |
-
print("starting download")
|
18 |
-
url = 'https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth'
|
19 |
-
r = requests.get(url, allow_redirects=True)
|
20 |
-
open("sam_vit_h_4b8939.pth", 'wb').write(r.content)
|
21 |
|
22 |
def greet(name):
|
23 |
-
downloadVith()
|
24 |
return "Hello " + name + "!!"
|
25 |
|
26 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def greet(name):
|
|
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|