Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,24 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def greet(name):
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def request_url(url):
|
| 6 |
+
headers = {
|
| 7 |
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
|
| 8 |
+
'Chrome/88.0.4324.146 Safari/537.36',
|
| 9 |
+
}
|
| 10 |
+
try:
|
| 11 |
+
response = requests.get(url=url, headers=headers)
|
| 12 |
+
if response.status_code == 200:
|
| 13 |
+
return response.text
|
| 14 |
+
except requests.RequestException:
|
| 15 |
+
return None
|
| 16 |
|
| 17 |
def greet(name):
|
| 18 |
+
url = f'https://huggingface.co/spaces?p=1&sort=modified&search=GPT'
|
| 19 |
+
html = request_url(url)
|
| 20 |
+
|
| 21 |
+
return "Hello " + html + "!!"
|
| 22 |
|
| 23 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 24 |
iface.launch()
|