Omnibus's picture
Update app.py
6cfa95b verified
raw
history blame
482 Bytes
import gradio as gr
import requests
import xmltodict
import json
def get_rss(rss_url):
r = requests.get(f'{rss_url}')
if ".json" in rss_url:
lod = json.loads(r.text)
if ".xml" in rss_url:
#with open() as xml_file:
lod = xmltodict.parse(r.text)
return lod
with gr.Blocks() as app:
with gr.Row():
inp = gr.Textbox()
btn = gr.Button()
out_json = gr.JSON()
btn.click(get_rss,inp,out_json)
app.launch()