Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import subprocess
|
|
| 4 |
import gradio as gr
|
| 5 |
def fetch_bibtex(arxiv_link):
|
| 6 |
# Extract the arXiv ID from the link
|
| 7 |
-
arxiv_id = re.findall(r'arxiv\.org\/(?:abs|pdf)\/([\w\.]+)', arxiv_link)[0]
|
| 8 |
|
| 9 |
|
| 10 |
# Use an API or web scraping method to fetch the BibTeX
|
|
@@ -13,10 +13,13 @@ def fetch_bibtex(arxiv_link):
|
|
| 13 |
|
| 14 |
command = "arxiv2bib"
|
| 15 |
|
|
|
|
|
|
|
| 16 |
result = subprocess.run([command, arxiv_id], stdout=subprocess.PIPE, text=True)
|
| 17 |
|
| 18 |
# Get the output
|
| 19 |
output = result.stdout
|
|
|
|
| 20 |
|
| 21 |
return output
|
| 22 |
|
|
@@ -25,4 +28,4 @@ interface = gr.Interface(fn=fetch_bibtex,
|
|
| 25 |
inputs=gr.Textbox(lines=2, placeholder="Enter arXiv link here..."),
|
| 26 |
outputs="text")
|
| 27 |
|
| 28 |
-
interface.launch()
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
def fetch_bibtex(arxiv_link):
|
| 6 |
# Extract the arXiv ID from the link
|
| 7 |
+
arxiv_id = re.findall(r'arxiv\.org\/(?:abs|pdf)\/([\w\.]+)', arxiv_link)[0].replace(".pdf","")
|
| 8 |
|
| 9 |
|
| 10 |
# Use an API or web scraping method to fetch the BibTeX
|
|
|
|
| 13 |
|
| 14 |
command = "arxiv2bib"
|
| 15 |
|
| 16 |
+
print(arxiv_id)
|
| 17 |
+
|
| 18 |
result = subprocess.run([command, arxiv_id], stdout=subprocess.PIPE, text=True)
|
| 19 |
|
| 20 |
# Get the output
|
| 21 |
output = result.stdout
|
| 22 |
+
print(output)
|
| 23 |
|
| 24 |
return output
|
| 25 |
|
|
|
|
| 28 |
inputs=gr.Textbox(lines=2, placeholder="Enter arXiv link here..."),
|
| 29 |
outputs="text")
|
| 30 |
|
| 31 |
+
interface.launch(share=True)
|