Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,25 @@
|
|
| 1 |
import requests
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
def get_api(inp,call,val,tot):
|
| 5 |
if not tot:
|
| 6 |
r = requests.get(f'{inp}?{call}={val}')
|
| 7 |
return (r.text)
|
| 8 |
else:
|
| 9 |
-
out_box=
|
|
|
|
| 10 |
for i in range(int(val)):
|
| 11 |
try:
|
| 12 |
r = requests.get(f'{inp}?{call}={i}')
|
|
|
|
| 13 |
#out={"id":r.text['id']}
|
| 14 |
#print (out)
|
| 15 |
-
out_box.append(r.text)
|
| 16 |
except Exception as e:
|
| 17 |
print (i+" - "+e)
|
| 18 |
pass
|
| 19 |
-
yield (
|
| 20 |
with gr.Blocks() as app:
|
| 21 |
with gr.Group():
|
| 22 |
with gr.Row():
|
|
|
|
| 1 |
import requests
|
| 2 |
import gradio as gr
|
| 3 |
+
import json
|
| 4 |
|
| 5 |
def get_api(inp,call,val,tot):
|
| 6 |
if not tot:
|
| 7 |
r = requests.get(f'{inp}?{call}={val}')
|
| 8 |
return (r.text)
|
| 9 |
else:
|
| 10 |
+
out_box=[]
|
| 11 |
+
data={}
|
| 12 |
for i in range(int(val)):
|
| 13 |
try:
|
| 14 |
r = requests.get(f'{inp}?{call}={i}')
|
| 15 |
+
data = data + json.dumps(r.text,indent=4)
|
| 16 |
#out={"id":r.text['id']}
|
| 17 |
#print (out)
|
| 18 |
+
#out_box.append(r.text)
|
| 19 |
except Exception as e:
|
| 20 |
print (i+" - "+e)
|
| 21 |
pass
|
| 22 |
+
yield (data)
|
| 23 |
with gr.Blocks() as app:
|
| 24 |
with gr.Group():
|
| 25 |
with gr.Row():
|