import requests import re import subprocess import radio as gr def fetch_bibtex(arxiv_link): print(arxiv_link) # Extract the arXiv ID from the link arxiv_id = re.findall(r'arxiv\.org\/(?:abs|pdf)\/([\w\.]+)', arxiv_link)[0].replace(".pdf","") # Use an API or web scraping method to fetch the BibTeX # For simplicity, here's a placeholder for the BibTeX entry bibtex_entry = "Placeholder BibTeX for " + arxiv_id command = "arxiv2bib" print(arxiv_id) result = subprocess.run([command, arxiv_id], stdout=subprocess.PIPE, text=True) # Get the output output = result.stdout return output interface = gr.Interface(fn=fetch_bibtex, inputs=gr.Textbox(label="URL"), outputs="text") interface.launch()